@mstnorris - Sure.
routes.php
Route::get('/', 'HomeController@index');
Route::get('/{id}', 'HomeController@content');
Route::get('/{title}/{id}', array('as' => 'gallery', 'uses' => 'HomeController@gallery'));
HomeController.php
<?php
class HomeController extends BaseController {
/*
|--------------------------------------------------------------------------
| Default Home Controller
|--------------------------------------------------------------------------
|
| You may wish to use controllers instead of, or in addition to, Closure
| based routes. That's great! Here is an example controller method to
| get you started. To route to this controller, just add the route:
|
| Route::get('/', 'HomeController@showWelcome');
|
*/
public function index()
{
//Gets the menu child item where it belongs with its parent. //Need to rephrase that better
$menus_child = Menu::where('menu_id', 0)->with('menusP')->get();
//Gets the home menu. It checks to see if the ID is 1 or if the title is home
$menu = Menu::where('id', 1)->orWhere('title', 'home')->firstOrFail();
//This gets the menu type which determins the template that is to be used
$layout = $menu->type;
$content = Content::where('id', 1)->orWhere('title', 'home')->firstOrFail();
//This gets all the contact information
$contact_bottom = Contact::all();
//This gets all the social media information
$social_media = SocialMedia::all();
//This gets all the menus
$main_menu = Menu::all();
$portfolios = Portfolio::orderBy('created_at', 'desc')->limit(6)->get();
return View::make('index', compact('menus_child', 'main_menu', 'content', 'contact_bottom', 'social_media', 'portfolios'))->with('menu', $menu, $main_menu, $content, $contact_bottom, $social_media, $portfolios);
}
public function content($id)
{
$menus_child = Menu::where('menu_id', 0)->with('menusP')->get();
$menu = Menu::where('id', $id)->firstOrFail();
$layout = $menu->type;
return View::make('public/'.$layout, compact('menus_child'))->with('menu', $menu);
}
public function gallery($title, $id) {
echo "ID: " . $id . " and the title is: " . $title;
}
}