Support the ongoing development of Laravel.io →
posted 10 years ago
Eloquent

Hello, I'm having a struggle with Laravel while trying to make post tags to work... Here is my problem:

I need to insert new tag or add an existing tag. I pass existing tags id to the system, and the tags which does not exist has their name. So technically i should get out with this code: http://pastebin.com/pDEnNeTK

Can anyone say what am I doing wrong? Because if the tag exists - i have a new tag created with the existing tag id as the name and then attached to my article...

Anyone has any ideas how to avoid that? Or I'm doing everything totally wrong?

Last updated 3 years ago.
0

You should be using is_numeric instead of is_integer

is_integer(1) //true
is_integer('1') //false

is_numeric(1) //true
is_numeric('1') //true

Last updated 3 years ago.
0

What a stupid mistake...

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ModestasV modestasv Joined 4 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.

© 2025 Laravel.io - All rights reserved.