I'm learning Laravel ad routes not working i don;t know why .. there is three files ( Welcome.blade.php
& route.php
& tryaction.php
) , tryaction
is a controller
in Welcome.balde.php
:
<ul>
<li><a href="{{ route('benice', ['action' => 'hug']) }}">Hug</a></li>
<li><a href="{{ route('benice', ['action' => 'kiss']) }}">Kiss</a></li>
<li><a href="{{ route('benice', ['action' => 'slap']) }}">Slap</a></li>
</ul>
in route.php
:
Route::get('/{action}/{name?}', [
'uses' => 'tryaction@doget',
'as' => 'benice'
]);
in tryaction.php
:
public function doget($action, $name = null){
return view('actions.'.$action,['name'=>$name]);
}
why it's not working and gives me notFound exception ?
note:actions views ar located in a folder called actions inside views
Now I tried something but still don't know the problem
I created the app using composer inside a folder inside htdocs using xampp server, the hierarchy looks like:
├── htdocs
│ ├── laravelprojects
│ | ├── myapp
when I moved myapp to htdocs directly it works .. why is that ?