PHP code example of namoshek / laravel-scout-database
1. Go to this page and download the library: Download namoshek/laravel-scout-database library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namoshek / laravel-scout-database example snippets
return new class extends Migration {
public function up(): void
{
Schema::table('scout_index', function (Blueprint $table) {
$table->uuid('tenant_id');
});
}
public function down(): void
{
Schema::table('scout_index', function (Blueprint $table) {
$table->dropColumn(['tenant_id']);
});
}
};
class User extends Model
{
public function toSearchableArray(): array
{
return [
'id' => $this->id,
'name' => $this->name,
'tenant_id' => new StandaloneField($this->tenant_id),
];
}
}