*/ protected $fillable = [ 'slug', 'title', 'content', 'is_active', ]; /** * Translatable fields * * @var array */ public $translatable = ['title', 'content']; /** * Retrieve the model for a bound value. * * @param mixed $value * @param string|null $field * @return \Illuminate\Database\Eloquent\Model|null */ public function resolveRouteBinding($value, $field = null) { return $this->where('slug', $value) ->where('is_active', true) ->firstOrFail(); } }