Open marijnhurkens opened 8 years ago
I found the problem in the upgrade guide:
Custom Directives
In prior versions of Laravel, when registering custom Blade directives using the directive method, the $expression passed to your directive callback contained the outer-most parenthesis. In Laravel 5.3, these outer-most parenthesis are not included in the expression passed to your directive callback. Be sure to review the Blade extension documentation and verify your custom Blade directives are still working properly.
I will try to create a pull request.
I have error with Fix
BadMethodCallException in Builder.php line 2437: Call to undefined method Illuminate\Database\Query\Builder::hasRole()
I can't reproduce that here, and I can imagine the fix won't work on pre 5.3 Laravel installations. What would be the best way to solve this?
Solved a problem here installing this package https://github.com/santigarcor/laratrust
Use with two parenthesis. Like this:
@role(('admin'))
...
@endrole
@permission(('role-edit'))
...
@endpermission
The file EntrustServiceProvider needs changed.
\Blade::directive('permission', function($expression) {
return "<?php if (\Entrust::can{$expression)) : ?>";
});
needs to be
\Blade::directive('permission', function($expression) {
return "<?php if (\Entrust::can({$expression})) : ?>";
});
if you add the () around {$expression } it works. you also need to change it for role and ability.
Hi @kezzab25,
Just want to clarify, is your resolution works on Laravel 5.3? Because I also found resolution here
What would be the best solution, modifying the class or use double parenthesis as what @marzochi advice?
I was using Laravel 5.2 before with Zizaco/Entrust and want to upgrade to 5.3, but before doing that just want some clarification before diving into it.
The double (( would work but I put in the the service file so that I wouldn't have to go and change it in multiple blade files.
On Sep 25, 2016 8:57 PM, "Angelo Escasio" notifications@github.com wrote:
Hi @kezzab25 https://github.com/kezzab25,
Just want to clarify, is your resolution works on Laravel 5.3? Because I also found resolution here https://github.com/Zizaco/entrust/issues/653
What would be the best solution, modifying the class or use double parenthesis as what @marzochi https://github.com/marzochi advice?
I was using Laravel 5.2 before with Zizaco/Entrust and want to upgrade to 5.3, but before doing that just want some clarification before diving into it.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Zizaco/entrust/issues/657#issuecomment-249463348, or mute the thread https://github.com/notifications/unsubscribe-auth/AERrge6Q3FqVETJI6Uc0vr7uhDYluC14ks5qtyaIgaJpZM4J6VQY .
@marzochi Thanks
it may help you
user like this : `@role(('admin'))
@endrole`
I'm currently upgrading to Laravel 5.3 and I found a problem with some of my templates when using the @role() directive from Entrust.
The error I get:
My view (testcase):
The rendered cached view:
Which off course gives a syntax error.
This could be an issue unrelated to Entrust, but I'm unable to find out what the problem is.