Answers for "eloquent self foreign key"

PHP
0

eloquent self foreign key

class User extends Eloquent {

    protected $table = 'users';
    public $timestamps = false;

    public function parent()
    {
        return $this->belongsTo('User', 'parent_id');
    }

    public function children()
    {
        return $this->hasMany('User', 'parent_id');
    }

}
Posted by: Guest on July-30-2021

Code answers related to "eloquent self foreign key"

Browse Popular Code Answers by Language