restore composer.json, add mysqli extension
This commit is contained in:
36
app/Models/City.php
Executable file
36
app/Models/City.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\LogOptionsTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
|
||||
class City extends Model
|
||||
{
|
||||
use LogsActivity, LogOptionsTrait;
|
||||
|
||||
protected $table = 'cities';
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected $casts = [
|
||||
'name' => 'array',
|
||||
'region_id' => 'integer'
|
||||
];
|
||||
|
||||
protected static $logName = 'cities';
|
||||
protected static $logOnlyDirty = true;
|
||||
protected static $logAttributes = ['name', 'region_id'];
|
||||
protected static $submitEmptyLogs = false;
|
||||
|
||||
public function region()
|
||||
{
|
||||
return $this->belongsTo(Region::class, 'region_id', 'id');
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return (string) $this->name['ru'] ?? null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user