feub
feub

Reputation: 589

Laravel authentication bundle

I'm pretty new to Laravel, I've spent some time reading about it and doing some tutorials. Lately, I've been following this tutorial about creating an authentication bundle:

http://net.tutsplus.com/tutorials/php/build-your-first-admin-bundle-for-laravel/

Basically, it's creating a simple custom auth driver extending the default auth one. Everything works quite nicely.. inside the bundle. My problem is more about how to use/access this admin/login bundle in my main application. I feel a bit ashamed asking this, I guess it has something to do with loading/starting the admin bundle in my application controller(s), but i can't get it to work.

Thank you

Upvotes: 0

Views: 997

Answers (1)

tplaner
tplaner

Reputation: 8471

You have a couple of options, you can either start the bundle manually from within your application controllers each time by calling:

Bundle::start("<Your Bundle Name>");

Or when you register the bundle with Laravel (when you add it to /application/bundles.php) you can also choose to autoload it:

return array(
    // ... other bundles
    "<Your Bundle Name>" => array("auto" => true),
);

From looking at the tutorial this might look something like:

'admin' => array('handles' => 'admin', 'auto' => true)

Once you have either started the bundle manually, or autoloaded it, you can then call the bundle classes directly (make sure you use the proper namespace when calling the class).

You can also check out Laravel's documentation.

Upvotes: 2

Related Questions