XF 2.2 Declaring relationships and how to use them

RisteDimitrievski

Active member
Licensed customer
The laravel has magic methods inside models you can declare the relationship in this way:
public function user(){ return $this->belongsTo('\App\User\,'user_id,'id'); } When u have to access the relation ship: $this->model = \App\Model::find(1); dd($this->model->user);
But i'm not sure about XenForo too..
 
See the relations section here for details:


You can see examples in the code in most entities (at least the slightly more extensive/complex ones).
 
Back
Top Bottom