Support the ongoing development of Laravel.io →
Views Forms
Last updated 2 years ago.
0

So far this is the best solution (still an ugly hack!)

$tags = $request->input('tag_list');
$company->tags()->sync($tags <> null ? $tags : []);
Last updated 9 years ago.
0

input method has a second argument -- default value, so you can reduce that code to one line:

$company->tags()->sync($request->input('tag_list', []));
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.