app/Http/Controllers/CategoriesController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
        $categories = Category::where('p_id', '=', null)->get();
        return view('categories.index',compact('categories','allCategories'));
    }
public function index ( ) { $ categories = Category :: where ( 'p_id' , '=' , null ) -> get ( ) ; return view ( 'categories.index' , compact ( 'categories' , 'allCategories' ) ) ; }
Display a listing of the resource.
Display a listing of the resource .
//dd($categories); //$allCategories = Category::pluck('title','id')->all(); //return view('categories.index')->withCategories($categories);