In my view, I want to print a controller uri like this ShopController@show.
set the var $controller = 'ShopControll';
in the view:
action($controller.'@show',$id)
but there are some error occured:
ErrorException in UrlGenerator.php line 603:
Action App\Http\Controllers\ShopController<?php echo $__env->yieldSection(); ?> not defined.
if like this:
action('ShopController@show',$id)
it works, output is:
http://example.com/show/1
So, what's the difference?
@show is a blade directive, blade parse it you want to show this as section please check here example
@section('sidebar')
This is the master sidebar.
@show
https://laravel.com/docs/5.2/blade#template-inheritance
you can modify you method like this
action($controller,'show',$id)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With