Reputation: 1912
I am pretty new to Laravel, I am so confused on how to start this. but basically I have a switch statement with different display mode cases and what I am trying to do is to connect routing with blade. How do I display $mycontent in blade based on cases like these ? Thanks
switch(MyPage::$some_display_mode) {
case 'normal':
$mycontent //this is what I want to display in blade
case 'ajax':
case 'other'
}
I want to connect these cases normal,ajax ,other etc with with different MyPages that I have so that I can display my blade files something like this
<html>
@yield('content)
</html>
@section('content')
whatever comes from the pages
@endsection
Upvotes: 0
Views: 42
Reputation: 271
You can use route groups and do something similar to this:
Route::group( [ 'prefix' => 'AJAX', 'namespace' => 'AJAX' ], function() {
Route::get( '/something', 'ajaxController@doSomething' );
});
There is multiple ways to group routes shown here:
Then handle returning the view in the controller and the use template-inheritance as explaned here:
This way will allow you to group and keep your routes organized
Upvotes: 1