-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tests and use distinct model classes
- Loading branch information
Showing
9 changed files
with
126 additions
and
136 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MongoDB\Laravel\Tests\Scout\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Schema\SQLiteBuilder; | ||
use Illuminate\Support\Facades\Schema; | ||
use Laravel\Scout\Searchable; | ||
use MongoDB\Laravel\Eloquent\SoftDeletes; | ||
|
||
use function assert; | ||
|
||
class ScoutUser extends Model | ||
{ | ||
use Searchable; | ||
use SoftDeletes; | ||
|
||
protected $connection = 'sqlite'; | ||
protected $table = 'scout_users'; | ||
protected static $unguarded = true; | ||
|
||
public function searchableAs(): string | ||
{ | ||
return 'mongodb_scout_users'; | ||
} | ||
|
||
/** | ||
* Check if we need to run the schema. | ||
*/ | ||
public static function executeSchema(): void | ||
{ | ||
$schema = Schema::connection('sqlite'); | ||
assert($schema instanceof SQLiteBuilder); | ||
|
||
$schema->dropIfExists('scout_users'); | ||
$schema->create('scout_users', function (Blueprint $table) { | ||
$table->increments('id'); | ||
$table->string('name'); | ||
$table->string('email')->nullable(); | ||
$table->date('email_verified_at')->nullable(); | ||
$table->timestamps(); | ||
$table->softDeletes(); | ||
}); | ||
} | ||
} |
This file contains 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
17 changes: 7 additions & 10 deletions
17
tests/Models/SearchableModel.php → tests/Scout/Models/SearchableModel.php
This file contains 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
This file contains 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
Oops, something went wrong.