mirror of
https://github.com/zoe-may/TDoG-Skin.git
synced 2024-11-24 13:52:19 +08:00
40 lines
897 B
PHP
Executable File
40 lines
897 B
PHP
Executable File
<?php
|
|
|
|
namespace Lorisleiva\LaravelSearchString\Tests\Stubs;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Lorisleiva\LaravelSearchString\Concerns\SearchString;
|
|
|
|
class Comment extends Model
|
|
{
|
|
use SearchString;
|
|
|
|
protected $searchStringColumns = [
|
|
'title' => ['searchable' => true],
|
|
'body' => ['searchable' => true],
|
|
'spam' => ['boolean' => true],
|
|
'user' => [
|
|
'key' => 'author',
|
|
'relationship' => true,
|
|
],
|
|
'favourites' => ['relationship' => true],
|
|
'favouritors' => ['relationship' => true],
|
|
'created_at' => 'date',
|
|
];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function favourites()
|
|
{
|
|
return $this->hasMany(CommentUser::class);
|
|
}
|
|
|
|
public function favouritors()
|
|
{
|
|
return $this->belongsToMany(User::class);
|
|
}
|
|
}
|