ollieread / multiauth

Laravel multi auth
441 stars 109 forks source link

Call to undefined method Ollieread\Multiauth\MultiauthServiceProvider::member() #53

Closed mikeritter closed 10 years ago

mikeritter commented 10 years ago

app/config/auth.php

<?php

// see https://github.com/ollieread/multiauth

return array(

    'multi' => array(
        'member' => array(
            'driver' => 'eloquent',
            'model' => 'Kettlebell\Member'
        ),
        'administrator' => array(
            'driver' => 'eloquent',
            'model' => 'Kettlebell\Administrator'
        )
    ),

    'reminder' => array(

        'email' => 'emails.auth.reminder',

        'table' => 'password_reminders',

        'expire' => 60,

    ),

);

app/routes.php

Route::get('/', function()
{
    if(Auth::member()->check()){
        return Redirect::to('dashboard');
    }
    else{
        return Redirect::to('login');
    }
});

I receive the error Call to undefined method Ollieread\Multiauth\MultiauthServiceProvider::member() everywhere I call Auth::member().

ollieread commented 10 years ago

Is shouldn't be calling MultiauthServiceProvider at all, the only reason it would do that is if you set the facade to use that. The default Auth facade is fine and should be left alone because of the way I hook into it. As long as the service provider has been added to the list it should all work.

mikeritter commented 10 years ago

Ah!

So, the problem is in /config/app.php!

    'aliases' => array(

        'App'             => 'Illuminate\Support\Facades\App',
        'Artisan'         => 'Illuminate\Support\Facades\Artisan',
        'Auth'            => 'Ollieread\Multiauth\MultiauthServiceProvider',
        'Blade'           => 'Illuminate\Support\Facades\Blade',
        'Cache'           => 'Illuminate\Support\Facades\Cache',
        'ClassLoader'     => 'Illuminate\Support\ClassLoader',
        'Config'          => 'Illuminate\Support\Facades\Config',
        'Controller'      => 'Illuminate\Routing\Controller',
        'Cookie'          => 'Illuminate\Support\Facades\Cookie',
        'Crypt'           => 'Illuminate\Support\Facades\Crypt',
        'DB'              => 'Illuminate\Support\Facades\DB',
        'Eloquent'        => 'Illuminate\Database\Eloquent\Model',
        'Event'           => 'Illuminate\Support\Facades\Event',
        'File'            => 'Illuminate\Support\Facades\File',
        'Form'            => 'Illuminate\Support\Facades\Form',
        'Hash'            => 'Illuminate\Support\Facades\Hash',
        'HTML'            => 'Illuminate\Support\Facades\HTML',
        'Input'           => 'Illuminate\Support\Facades\Input',
        'Lang'            => 'Illuminate\Support\Facades\Lang',
        'Log'             => 'Illuminate\Support\Facades\Log',
        'Mail'            => 'Illuminate\Support\Facades\Mail',
        'Paginator'       => 'Illuminate\Support\Facades\Paginator',
        'Password'        => 'Illuminate\Support\Facades\Password',
        'Queue'           => 'Illuminate\Support\Facades\Queue',
        'Redirect'        => 'Illuminate\Support\Facades\Redirect',
        'Redis'           => 'Illuminate\Support\Facades\Redis',
        'Request'         => 'Illuminate\Support\Facades\Request',
        'Response'        => 'Illuminate\Support\Facades\Response',
        'Route'           => 'Illuminate\Support\Facades\Route',
        'Schema'          => 'Illuminate\Support\Facades\Schema',
        'Seeder'          => 'Illuminate\Database\Seeder',
        'Session'         => 'Illuminate\Support\Facades\Session',
        'SoftDeletingTrait' => 'Illuminate\Database\Eloquent\SoftDeletingTrait',
        'SSH'             => 'Illuminate\Support\Facades\SSH',
        'Str'             => 'Illuminate\Support\Str',
        'URL'             => 'Illuminate\Support\Facades\URL',
        'Validator'       => 'Illuminate\Support\Facades\Validator',
        'View'            => 'Illuminate\Support\Facades\View',

    ),

);

I apologize.

ollieread commented 10 years ago

Yeah, there's no need to change the Facade for Auth, plus you wouldn't point it to a service provider anyway.

mikeritter commented 10 years ago

Id10t error.

On Aug 28, 2014, at 9:25 AM, Ollie Read notifications@github.com wrote:

Yeah, there's no need to change the Facade for Auth, plus you wouldn't point it to a service provider anyway.

— Reply to this email directly or view it on GitHub.

ollieread commented 10 years ago

No worries, I often forget how to use this package, worst thing being it's mine ahaha.