mardi 14 février 2017

Set OneToMany relation in Laravel with exception in relation

I've create to tables with OneToMany relation. Two tables are Malls and Shops. Each Mall can have many Shop but the problem is each Shop is not necessarily belongs to a Mall. It can be a stand alone shop.

When I call App\Shop::first()->mall if the shop doesn't belongs to a Mall would it return null or throws exception or error?

How is it possible in Eloquent?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kGjoBg
via IFTTT

Aucun commentaire:

Enregistrer un commentaire