Skip to content

Commit

Permalink
feat(frontend): Add Search function
Browse files Browse the repository at this point in the history
  • Loading branch information
scouillard committed Mar 6, 2020
1 parent 7800186 commit 6592b23
Show file tree
Hide file tree
Showing 18 changed files with 656 additions and 53 deletions.
2 changes: 2 additions & 0 deletions app/Http/Controllers/RecettesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public function recetteStar (Request $request, Recette $recette) {

public function index()
{
$recettes = Recette::all();

return view('recettes/index', compact('recettes'));
}

/**
Expand Down
2 changes: 2 additions & 0 deletions app/Recette.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

use willvincent\Rateable\Rateable;
use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable;

class Recette extends Model {

use Searchable;
use Rateable;

protected $guarded = [];
Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"bkwld/laravel-pug": "^1.11",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.8.*",
"laravel/scout": "7.0",
"laravel/tinker": "^1.0",
"laravelcollective/html": "^5.8.0",
"pug-php/pug": "^3.3",
"willvincent/laravel-rateable": "1.0.9"
},
Expand Down
135 changes: 134 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,

Collective\Html\HtmlServiceProvider::class,

/*
* Package Service Providers...
*/
Expand Down Expand Up @@ -226,6 +228,9 @@
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,

'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,

],

];
91 changes: 91 additions & 0 deletions config/scout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Default Search Engine
|--------------------------------------------------------------------------
|
| This option controls the default search connection that gets used while
| using Laravel Scout. This connection is used when syncing all models
| to the search service. You should adjust this based on your needs.
|
| Supported: "algolia", "null"
|
*/

'driver' => env('SCOUT_DRIVER', 'algolia'),

/*
|--------------------------------------------------------------------------
| Index Prefix
|--------------------------------------------------------------------------
|
| Here you may specify a prefix that will be applied to all search index
| names used by Scout. This prefix may be useful if you have multiple
| "tenants" or applications sharing the same search infrastructure.
|
*/

'prefix' => env('SCOUT_PREFIX', ''),

/*
|--------------------------------------------------------------------------
| Queue Data Syncing
|--------------------------------------------------------------------------
|
| This option allows you to control if the operations that sync your data
| with your search engines are queued. When this is set to "true" then
| all automatic data syncing will get queued for better performance.
|
*/

'queue' => env('SCOUT_QUEUE', false),

/*
|--------------------------------------------------------------------------
| Chunk Sizes
|--------------------------------------------------------------------------
|
| These options allow you to control the maximum chunk size when you are
| mass importing data into the search engine. This allows you to fine
| tune each of these chunk sizes based on the power of the servers.
|
*/

'chunk' => [
'searchable' => 500,
'unsearchable' => 500,
],

/*
|--------------------------------------------------------------------------
| Soft Deletes
|--------------------------------------------------------------------------
|
| This option allows to control whether to keep soft deleted records in
| the search indexes. Maintaining soft deleted records can be useful
| if your application still needs to search for the records later.
|
*/

'soft_delete' => false,

/*
|--------------------------------------------------------------------------
| Algolia Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your Algolia settings. Algolia is a cloud hosted
| search engine which works great with Scout out of the box. Just plug
| in your application ID and admin API key to get started searching.
|
*/

'algolia' => [
'id' => env('ALGOLIA_APP_ID', ''),
'secret' => env('ALGOLIA_SECRET', ''),
],

];
Loading

0 comments on commit 6592b23

Please sign in to comment.