Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

You have a typo here:

protected $fillabel = [...];

so probably you save empty value in some fields, that have unique index.

However that's probably not the case, right?

Try this instead:

$tags = array(
    Tag::firstOrNew(array('tag'=>'SCIFI')),
    Tag::firstOrNew(array('tag'=>'FANTASY')),
    Tag::firstOrNew(array('tag'=>'ADVENTURE')),
);

Mind that this will call db query for each tag.

Last updated 2 years ago.
0

Thank You,

It works! :)

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

progeja progeja Joined 22 Sep 2014

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.