Basic Examples

// Create a new Permission$permission=newToddish\Verify\Models\Permission;$permission->name='delete_user';$permission->save();// Create a new Role$role=newToddish\Verify\Models\Role;$role->name='Moderator';$role->level=7;$role->save();// Assign the Permission to the Role$role->permissions()->sync([$permission->id]);// Create a new User$user=newToddish\Verify\Models\User;$user->username='Todd';$user->email='todd@toddish.co.uk';$user->password='password'; // This is automatically salted and encrypted$user->save();// Assign the Role to the User$user->roles()->sync(array($role->id));// Using the public methods available on the User objectvar_dump($user->is('Moderator')); // truevar_dump($user->is('Admin')); // falsevar_dump($user->can('delete_user')); // truevar_dump($user->can('add_user')); // falsevar_dump($user->level(7)); // truevar_dump($user->level(5, '<=')); // false

Auth::verify()

Verify ships with a new login method, Auth::verify().

This method takes the same arguments as Auth::attempt(), with the main difference being it returns a string, and checks if the user is disabled or verified too.