Built for Cartalyst SubscribersSubscribe
Every application needs some level of authorization & authentication. Sentinel Kickstart provides a robust set of features used by thousands of developers backed by a dedicated support team.
A Clean and simple architecture includes all views necessary for an authorized and authenticated application .
Allows you to authenticate your users through popular social networks & other OAuth 1/2 providers.
A Semantically versioned & well supported code base that adheres to high documentation standards both inside and out.
Multi-Tenancy, Expiring Permissions, and OAuth Server Add-ons coming soon!
A quickstart guide to get you started
Registration allows you to collect details from a user for registration.
public function register()
{
if ($user = Sentinel::register(Input::all()))
{
return Redirect::home()->withSuccess('Registration complete.');
}
return Redirect::back()->withInput()->withErrors('An error occured while registering.');
}
Authentication allows you to collect details from a user for authentication. Creating a session and returning the user object.
public function authenticate()
{
if ($auth = Sentinel::authenticate(Input::all()))
{
return Redirect::intended();
}
return Redirect::back()
->withInput()
->withErrors('Invalid login or password.');
}
Once you have authenticated, a session has been created. At this point you'll most likely want to do something with the users meta data.
public function update()
{
$input = Input::all();
$user = Sentinel::getUser();
Sentinel::update($user, $input);
return Redirect::back()
->withSuccess('User successfully updated.');
}
Assigning roles will ensure the permissions set on the role are inherited on the user.
public function assignRole()
{
$role = Sentinel::findRoleBySlug('admin');
$user = Sentinel::getUser();
$user->roles()->attach($role);
return Redirect::back()
->withSuccess('Role attached successfully.');
}
Adding permissions to perform checks against later on.
public function addPermission()
{
$permission = Input::get('permission');
$role = Sentinel::findRoleBySlug('admin');
$role->addPermission($permission);
$role->save();
return Redirect::back()->withSuccess('Permission added successfully.');
}
Performing permission checks can be conducted using route filters.
Route::filter('auth.admin', function()
{
if ( ! Sentinel::hasAccess('admin'))
{
return Redirect::home()->withErrors('You are not permitted to access this area.');
}
});