jeudi 23 novembre 2017

Laravel relationships to tables.

Quite new to Laravel and learning it now for work and just wonder, why do you have to use relationships, when you can simply use?

$n = Name::find(2) $a = Address::where('name_id', '=', $n['id'])->get()

Instead of forming a relationship in the controller and:

$n = Name::find(2) $n->address

Is it to less complicated somehow or is it just to reduce code or what?.

Any help appreciated and thanks in advance.



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

Aucun commentaire:

Enregistrer un commentaire