Answer the question
In order to leave comments, you need to log in
Request in laravel doesn't form slug field?
in the model
public function setSlugAttribute($value){
$this->attributes['slug'] = Str::slug($this->title,"-");
}
public function store(Request $request)
{
dd($request->all());
}
array:5 [▼
"title" => "Second"
"published" => "1"
"slug" => null
"parent_id" => "0"
]
Category::create($request->all());
Answer the question
In order to leave comments, you need to log in
The mutator only works when you set a model property and Request has nothing to do with it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question