Answer the question
In order to leave comments, you need to log in
How can $request->all()->except(['my_parametr']) take everything except from the request?
It doesn't work like this: $request->all()->except(['product_slug'])
If the slug is empty, you need to generate it, therefore exclude the one from the request, and create your own, something like:
Product::create($request->all()->except(['product_slug']) + ['product_slug' => $generatedSlug] );
Answer the question
In order to leave comments, you need to log in
$tmp_arr = $request->all();
if(empty($tmp['product_slug'])){
$tmp_arr['product_slug'] = $generatedSlug;
}
Product::create($tmp_arr);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question