1 month ago

Clean Code for request->all()

Posted 1 month ago by chrisgrim

Hi I have this code that I have tried to optimize as much as possible

if (!$organizer = $organizer->updateOrCreate($request->all())) {
            return response()->json(['error' => 'Failed to save organizer'], 402);

The model calls for a slug which normally I would do 'slug' => str_slug(request('title'))

How would I add just this one without having to move away from request all and listing all of my requests?

Please sign in or create an account to participate in this conversation.