vendredi 30 octobre 2015

Laravel ACL: Policy Class not being read

So in AuthServiceProvider I am doing following:

namespace App\Providers;

use Illuminate\Contracts\Auth\Access\Gate as GateContract;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;


class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        \App\Post::class => PostPolicy::class
    ];

    /**
     * Register any application authentication / authorization services.
     *
     * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
     * @return void
     */
    public function boot(GateContract $gate)
    {
        parent::registerPolicies($gate);

    }

PostPolicy

namespace App\Policies;

use App\Post;
use App\User;

class BriefPolicy
{
    /**
     * Create a new policy instance.
     *
     * @return void
     */
    public function __construct()
    {
    }
    public function view(User $user)
    {
        dd('he was here');//This line NEVER gets executed.
        return $user->type === 'user';
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire