0

Here is my controller -

public function add_sub_main_category($sub_id)
{
                $add_sub_catg_details = Category::add_sub_catg_details($sub_id);
                return View::make('manage')->with('add_sub_catg_details', $add_sub_catg_details);
}  

Here is my model -

public static function add_sub_catg_details($catg_id)
{
    return DB::table('nm_secmaincategory')->where('smc_id', '=', $catg_id)->get();
}  

Here is my view -

@foreach($add_sub_catg_details as $add_sub_catg_det)
<tr>{{$add_sub_catg_det->smc_name}}</tr>
@endforeach

My Route -

 Route::get('/add_sub_main_category',array('as'=>'add_sub_main_category','uses'=>'CategoryController@add_sub_main_category'));

My Schema:

Category Table SubCategory Table

The Problem I am facing is I need to get data from the subcategory table based on the smc_mc_id which is the ID column in the Category table and display the name of the item in Sub Category based on the ID's.

Suraj Sli
  • 11
  • 1

0 Answers0