i would not recommend hard coding route paths in the view, instead use a route name, so you can easily change route path later without changing anything in the templates
Route::get('myProject/public/project/8/about-project', 'method@controllerClass')->name('about-project')
then in the template
@if(\Request::route()->getName() == 'about-project')
@include('projects.projectDetails.aboutProject')
@endif
Thanks @astroanu for you reply but now I have Error:
Call to undefined method Illuminate\Routing\Route::name()
I am using Laravel 4.2
and the Error is coming from this part
->name
i think for 4.2 you have to pass it like this
Route::get('myProject/public/project/8/about-project', array('as' => 'about-project', 'uses' => 'method@controllerClass'));
also i noticed you're calling public in your route path. make sure the virtual host is pointed to the public folder root not the MyProject folder root, you should be calling 'public/project/8/about-project' not 'myProject/public/project/8/about-project'
astroanu said:
i think for 4.2 you have to pass it like this
Route::get('myProject/public/project/8/about-project', array('as' => 'about-project', 'uses' => 'method@controllerClass'));
Yes this worked fine, but still this one not
@if(\Request::route()->getName() == 'about-project')
@include('projects.projectDetails.aboutProject')
@endif
not recognize route()
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community