?
Current File : /home/sanghavirealty/public_html/appazwer/Models/Navigation.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Navigation extends Model
{
    use HasFactory;

    public $table="cmscategorytbl";

    const CREATED_AT = 'createdate';
    const UPDATED_AT = 'modifydate';

    
    public function getParentTitle()
    {
            return $this->belongsTo(Navigation::class, 'parentid' );
    }


    public function navSub()
    {

     return $this->hasMany(Navigation::class,'parentid')->with('navSub') ;
 
     }


     public static function getComposerShowNavigation ($type){

        $dataviewer = Navigation::Where('type',$type)
        ->Where('parentid',0)
        ->Where('currentstatus',0)
        ->orderBy('navOrder', 'ASC')
        ->with('navSub.navSub')
        ->get();


        
     return $dataviewer ;

        //  return view('navigation.headernavigator',['data'=>$dataviewer]);


    }







}