app/Models/SubCate.php
// SUB CATEGORY RELATIONSHIP WITH MAIN CATEGORY
SUB CATEGORY RELATIONSHIP WITH MAIN CATEGORY
SUB CATEGORY RELATIONSHIP WITH MAIN CATEGORY
public function mainCate()
    {
        return $this->belongsTo(
            MainCate::class,
            'cate_id',
            'id'
        );
    }
public function mainCate ( ) { return $ this -> belongsTo ( MainCate :: class , 'cate_id' , 'id' ) ; }
SUB CATEGORY RELATIONSHIP WITH MAIN CATEGORY
SUB CATEGORY RELATIONSHIP WITH MAIN CATEGORY
// RETURN THE MAIN CATEGORY RELATED TO THIS SUB CATEGORY