本文整理汇总了PHP中Illuminate\Foundation\Support\Providers\AuthServiceProvider类的典型用法代码示例。如果您正苦于以下问题:PHP AuthServiceProvider类的具体用法?PHP AuthServiceProvider怎么用?PHP AuthServiceProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AuthServiceProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
// $gate->define('update-post', function ($user, $post) {
// return $user->id === $post->user_id;
// });
}
示例2: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
$gate->define('isadmin', function () {
return Auth::user()->role == 1 && Auth::user();
});
}
示例3: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
view()->composer('partials.nav', function (View $view) {
$view->with('user', Auth::user());
});
}
示例4: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
$gate->define('admin', function ($user) {
return $user->group == 'admin';
});
}
示例5: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
$gate->define('access-admin', function ($user) {
return $user->role === 2 || $user->role === 1;
});
}
示例6: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
$gate->define('update-post', function ($autor, $artigo) {
return $autor->id_autor === $artigo->id_autor;
});
}
示例7: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
$gate->define('show-order', function ($user, $order) {
return $user->id == $order->user_id;
});
}
示例8: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
$gate->define('update-user', function ($user, $recordId) {
return $user->id == $recordId || $user->isAdmin();
});
}
示例9: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
$gate->define('moderate', function ($user) {
return $user->admin === 1;
});
}
示例10: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
$gate->define('admin', function (User $user) {
return $user->email == "juan2sramos@gmail.com";
});
}
示例11: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
$gate->define('update-contact', function ($user, $contact) {
return $user->id === $contact->user_id;
});
}
示例12: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
$gate->define('manage', function ($user) {
return $user->role_id == 1;
});
}
示例13: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
// Defined abilities
# Super Admin
$gate->define('super-admin', function ($user) {
return $user->role === 'admin' || $user->role === 'super-admin';
});
# Tasks
$gate->define('update-task', function ($user, $task) {
return $user->id === $task->id_users;
});
$gate->define('delete-task', function ($user, $task) {
$flag = $user->role === 'admin' || $user->id === $task->id_users ? true : false;
return $flag;
});
$gate->define('delete-task-admin', function ($user, $task) {
return $user->role === 'admin';
});
# Boards
$gate->define('update-board', function ($user, $board) {
$flag = $user->role === 'admin' || $user->id === $board->id_users ? true : false;
return $flag;
});
$gate->define('delete-board', function ($user, $board) {
$flag = $user->role === 'admin' || $user->id === $board->id_users ? true : false;
return $flag;
});
$gate->define('delete-board-admin', function ($user, $board) {
$flag = $user->role === 'admin' ? true : false;
return $flag;
});
}
示例14: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
$gate->define("admin", function (User $user) {
return $user->roles()->getQuery()->where("name", "=", "admin")->count() > 0;
});
//
}
示例15: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
//Only User can edit
$gate->define('see-edit', function ($user, $video) {
return $user->id === $video->user_id;
});
}