Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 1 year ago.
0

Any advice?

0

You can't. in Laravel 5 you will have to namespace your classes.

hasOne does not need a where. It is a relationship you set so you can enforce what object_type it is when you generate that relationship.

0

How to enforce?

What should i write instead of 'where'?

   public function html_meta()
    {
        return $this->hasOne('App\HtmlMeta','object_id','id')->where('object_type','=','2');
    }

Last updated 9 years ago.
0

any advice?

0

Guys want to get some good case for this? Any one?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

gelnor gelnor Joined 20 Jan 2015

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.