vendredi 24 juin 2016

Laravel 5 package not able to access sentinel from parent controller

So I am getting the following error Class sentinel does not exist, what I am attempting to do is have a package controller that extends my admin area controller which runs checks against the user being logged in etc.

Here is the my package controller at the moment, I am trying to extend the AdministrationController to access some settings I have setup globally for the admin section of the site.

<?php

namespace Sitemanager\Blog\Controllers;

use App\Http\Controllers\Administration\AdministrationController;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class BlogController extends AdministrationController
{

    public function __construct()
    {
        $this->middleware('sentinel');

        parent::__construct();
    }


}

Now If i add sentinel like so: use Cartalyst\Sentinel\Laravel\Facades\Sentinel; within my package then any Sentinel calls work (if called directly within the BlogController).

However, the parent constructor call is giving me the Class sentinel does not exist which in this case runs Sentinel::getUser();. Even if i try and call it globally \Sentinel::getUser();; i get a similar error Call to undefined method Cartalyst\Sentinel\Laravel\Facades\Sentinel::getUser().

I'm presuming I cant access Sentinel from within the package, but i dont understand why... Is there a way I can get this to work?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/28S3odz
via IFTTT

Aucun commentaire:

Enregistrer un commentaire