You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
768 B
39 lines
768 B
5 years ago
|
<?php
|
||
|
|
||
|
namespace App;
|
||
|
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
use App\Appended\Traites\UpdateModels;
|
||
|
|
||
|
|
||
|
class BusinessTitle extends Model
|
||
|
{
|
||
|
|
||
|
use UpdateModels;
|
||
|
|
||
|
protected $fillable=['name_fa','name_en','category_id','details'];
|
||
|
|
||
|
public function business()
|
||
|
{
|
||
|
return $this->hasMany('App\Business');
|
||
|
}
|
||
|
|
||
|
public function category()
|
||
|
{
|
||
|
return $this->belongsTo('App\Category');
|
||
|
}
|
||
|
|
||
|
public function setDetailsAttribute($value)
|
||
|
{
|
||
|
$this->attributes['details'] = json_encode($value, JSON_UNESCAPED_UNICODE);
|
||
|
}
|
||
|
public function getDetailsAttribute()
|
||
|
{
|
||
|
return json_decode($this->attributes['details']);
|
||
|
}
|
||
|
|
||
|
protected function clearCacheItems(){
|
||
|
Cache::forget('business_title');
|
||
|
}
|
||
|
}
|