Jul 12, 2016
0
Level 2
Check if URL has certain string
I am trying to check my URL for certain string if it's there include somePage here is what I try
@if(Request::path()=='/about-project')
@include('projects.projectDetails.aboutProject')
@endif
and this is my full URL
http://localhost/elarabiaLaravel/public/project/8/about-project
my full IDEA
in native PHP I use to have this done by using
if(isset($_GET['val']))
and then switch using cases
like:
case 1:
include 'path/of/my/file.php';
break;
I know Laravel don't use switch
after search I came up with this
I made my links like so..
<li>{{ HTML::link("project/$viewPro->id/about-project", 'about')}}</li>
and in the ROUTE
Route::get('project/{id}/about-project', 'projectController@viewProject');
if there is a cleaner way to accomplish this I will be happy to learn
thanks
Please or to participate in this conversation.