2023-08-14 13:33:53 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2023-09-25 13:07:19 -07:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
2023-08-14 13:33:53 -07:00
|
|
|
|
|
|
|
class Location extends Model
|
|
|
|
{
|
|
|
|
use HasFactory;
|
2023-09-25 13:07:19 -07:00
|
|
|
use SoftDeletes;
|
2023-08-14 13:33:53 -07:00
|
|
|
|
2023-08-16 17:52:02 -07:00
|
|
|
/**
|
|
|
|
* The table associated with the model.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $table = "location";
|
|
|
|
|
|
|
|
protected $primaryKey = 'id';
|
|
|
|
public $incrementing = true;
|
|
|
|
protected $fillable = [
|
|
|
|
"uuid",
|
|
|
|
"name",
|
2023-08-24 15:27:14 -07:00
|
|
|
"url",
|
2024-09-29 16:34:52 -06:00
|
|
|
"public_comments",
|
2023-08-24 15:27:14 -07:00
|
|
|
"images",
|
|
|
|
"active",
|
|
|
|
"rating",
|
|
|
|
"added_by",
|
|
|
|
"tags",
|
|
|
|
"block_count",
|
2023-09-25 13:07:19 -07:00
|
|
|
"silence_count",
|
2023-08-24 15:27:14 -07:00
|
|
|
"created_at",
|
2024-02-09 21:05:33 -06:00
|
|
|
"updated_at",
|
2024-02-20 16:33:49 -06:00
|
|
|
"actions_count",
|
2024-10-04 14:04:49 -06:00
|
|
|
"archive_links",
|
|
|
|
"notes",
|
2023-08-24 15:27:14 -07:00
|
|
|
];
|
2025-04-15 13:58:12 -06:00
|
|
|
|
|
|
|
public function scopeSearch($query, $search)
|
|
|
|
{
|
|
|
|
if (!$search) {
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
return $query->whereRaw('searchtext @@ to_tsquery(\'english\', ?)', [$search])
|
|
|
|
->orderByRaw('ts_rank(searchtext, to_tsquery(\'english\', ?)) DESC', [$search]);
|
|
|
|
}
|
2023-08-14 13:33:53 -07:00
|
|
|
}
|