-
-
Save PierreLebedel/a338b6f4209287814d35016f2915d92d to your computer and use it in GitHub Desktop.
Laravel 12 Meilisearch command for "composer run dev"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MEILISEARCH_HOST=http://127.0.0.1:7700 | |
MEILISEARCH_KEY=masterKey | |
MEILISEARCH_BIN="C:\\path\\to\\meilisearch\\bin" # Add this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"dev": [ | |
"Composer\\Config::disableProcessTimeout", | |
"npx concurrently -c \"#93c5fd,#c4b5fd,#fdba74,#e41359\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"npm run dev\" \"php artisan app:meilisearch-run\" --names='server,queue,vite,meilisearch'" | |
] | |
}, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Console\Commands; | |
use Illuminate\Console\Command; | |
use Illuminate\Support\Facades\Process; | |
class MeilisearchRunCommand extends Command | |
{ | |
protected $signature = 'app:meilisearch-run'; | |
protected $description = 'Starts and runs the Meilisearch binary'; | |
public function handle() | |
{ | |
$binPath = config('scout.meilisearch.bin_path'); | |
if(!$binPath){ | |
$this->error("Meilisearch binary path not provided. Please add it to your .env & config/scout.php files."); | |
return self::INVALID; | |
} | |
$this->line("Meilisearch binary path provided. Go to ".config('scout.meilisearch.host')." to see the dashboard."); | |
Process::forever() | |
->path($binPath) | |
->run('meilisearch --master-key="'.config('scout.meilisearch.key').'"'); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'meilisearch' => [ | |
'host' => env('MEILISEARCH_HOST', 'http://localhost:7700'), | |
'key' => env('MEILISEARCH_KEY'), | |
'bin_path' => env('MEILISEARCH_BIN'), // Asdd this | |
'index-settings' => [], | |
], |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment