ollieread / multiauth

Laravel multi auth
441 stars 109 forks source link

Class 'Ollieread\Multiauth\MultiauthServiceProvider' not found #30

Closed leankarlo closed 10 years ago

leankarlo commented 10 years ago

Hi Ollie,

I've tried using your code in laravel for 2 table login. But i'm having this error. Could you help me?

Symfony \ Component \ Debug \ Exception \ FatalErrorException Class 'Ollieread\Multiauth\MultiauthServiceProvider' not found

I copy paste the Ollieread folder to vendor/laravel/framework/src beside the Illuminate folder.

here is my auth.php code

<?php

return array(

    'driver' => 'eloquent',
    'model' => 'User',
    'table' => 'users',

    'multi' => array(
        'patient' => array(
            'driver' => 'eloquent',
            'model' => 'Patient',
            'table'=>'patients'
        ),
        'doctor' => array(
            'driver' => 'eloquent',
            'model' => 'Doctor',
            'table'=>'doctors'
        )
    ),

    'reminder' => array(

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

    'table' => 'password_reminders',

    'expire' => 60,

    ),

);

Here is my app.php

<?php
'providers' => array(

    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    'Ollieread\Multiauth\MultiauthServiceProvider',
    'Illuminate\Cache\CacheServiceProvider',
    'Illuminate\Session\CommandsServiceProvider',
    'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
    'Illuminate\Routing\ControllerServiceProvider',
    'Illuminate\Cookie\CookieServiceProvider',
    'Illuminate\Database\DatabaseServiceProvider',
    'Illuminate\Encryption\EncryptionServiceProvider',
    'Illuminate\Filesystem\FilesystemServiceProvider',
    'Illuminate\Hashing\HashServiceProvider',
    'Illuminate\Html\HtmlServiceProvider',
    'Illuminate\Log\LogServiceProvider',
    'Illuminate\Mail\MailServiceProvider',
    'Illuminate\Database\MigrationServiceProvider',
    'Illuminate\Pagination\PaginationServiceProvider',
    'Illuminate\Queue\QueueServiceProvider',
    'Illuminate\Redis\RedisServiceProvider',
    'Illuminate\Remote\RemoteServiceProvider',
    'Illuminate\Auth\Reminders\ReminderServiceProvider',
    'Illuminate\Database\SeedServiceProvider',
    'Illuminate\Session\SessionServiceProvider',
    'Illuminate\Translation\TranslationServiceProvider',
    'Illuminate\Validation\ValidationServiceProvider',
    'Illuminate\View\ViewServiceProvider',
    'Illuminate\Workbench\WorkbenchServiceProvider',

),

Hope to hear from you soon

Thanks, Lean Karlo U. Corpuz

ollieread commented 10 years ago

There's a problem with the config and a second amendment that could be made.

If you're going to use the multiauth reminder service, then you'll need to replace the serviceprovider for the default reminder, and if not, you'll need to remove the default as it'll cause some issues.

You can actually remove the default bit of auth specifying the model, type and table.

'driver' => 'eloquent',
'model' => 'User',
'table' => 'users',

That's never used so it isn't needed.

The problem is that since you aren't using composer, you don't have any autoload functionality. To put it simply, Laravel doesn't know how to load my file, so you'll either need to generate an autoload yourself composer dumpautoload or use the artisan command php artisan dump-autoload which I believe will fix the problem for you.

leankarlo commented 10 years ago

thanks for the help it worked.