AdminLTE Laravel template screenshoot:
how can i direct the link into my page in folder lapor/one.blade.php and lapor/two.blade.php?
<li class="treeview">
<a><i class='fa fa-file'></i> <span>Laporan</span> <i class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<li><a href="{{ url('') }}">One</a></li>
<li><a href="{{ url('') }}">Two</a></li>
</ul>
</li>
Before going to redirect the page two steps you need to do :
Step 1:
Define Methods in controller(named as SampleController) for example:
//Controller Name:SampleController
// Method Names defined in controller :lapor1,lapor2
//Method 1
public function lapor1(){
return view('lapor.one');
}
//Method 2
public function lapor2(){
return view('lapor.two');
}
Step :2
Define Routes for the pages like below:
Route::get('lapor1', ['as' => 'laporone','uses'=>'SampleController@lapor1']);
Route::get('lapor2', ['as' => 'laportwo','uses'=>'SampleController@lapor2']);
Step 3:
Link up to view pages now:
<li><a href="/lapor1">One</a></li>
<li><a href="/lapor2">Two</a></li>
Make a route like below
Route::get('one', function () {
return view('lapor.one');
});
Route::get('two', function () {
return view('lapor.two');
});
And link it like below
<li><a href="/one">One</a></li>
I would group your adminLTE routes:
Route::group(['prefix' => 'admin', 'as' => 'admin.'], function()
{
Route::get('/', ['as' => 'dashboard', 'uses' => 'AdminController@index']);
Route::get('users', ['as' => 'user', 'uses' => 'AdminController@users']);
});
We prefixed those routes with /admin/ or whatever you want to call it. Then we prefixed their name with admin (using 'as').
Now get a specific route url:
{{ route('admin.dashboard') }}
Why do it like this?
Naming your routes is very important because if the route url changes and your app has hardcored urls (like url('/admin/dashboard') your entire application will break. With named routes this wont happen.
You can do it in three step:
make a function in your controller.like below
publice function functionName(){ return view('yourpagename(one)'); }
go to routes folder open web.php and connect with your controller function in routes. like
Route::get('page-name', 'controllerName@functionName');
add this url to your view page link tag
{{URL::to('page-name')}}
Hope it will works fine.