Answers for "select parent id same table laravel"

PHP
1

laravel parent child same table

public function parent()
    {
        return $this->belongsTo('App\CourseModule','parent_id')->where('parent_id',0);
    }

    public function children()
    {
        return $this->hasMany('App\CourseModule','parent_id');
    }
Posted by: Guest on October-29-2020
0

how to select name parent table in model laravel

$books = App\Book::with('author.contacts')->get();
Posted by: Guest on February-11-2021

Code answers related to "select parent id same table laravel"

Browse Popular Code Answers by Language