当前位置: 首页>>代码示例>>PHP>>正文


PHP User::is方法代码示例

本文整理汇总了PHP中app\User::is方法的典型用法代码示例。如果您正苦于以下问题:PHP User::is方法的具体用法?PHP User::is怎么用?PHP User::is使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\User的用法示例。


在下文中一共展示了User::is方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: destroy

 /**
  * Determine if the given user can delete the given calendar.
  *
  * @param User $user
  * @param Calendar $calendar
  *
  * @return bool
  */
 public function destroy(User $user, Calendar $calendar)
 {
     if ($user->canDo('calendar.calendar.delete') && $user->is('admin')) {
         return true;
     }
     return $user->id === $calendar->user_id;
 }
开发者ID:lavalite,项目名称:calendar,代码行数:15,代码来源:CalendarPolicy.php

示例2: destroy

 /**
  * Determine if the given user can delete the given message.
  *
  * @param User $user
  * @param Message $message
  *
  * @return bool
  */
 public function destroy(User $user, Message $message)
 {
     if ($user->canDo('message.message.delete') && $user->is('admin')) {
         return true;
     }
     return $user->id === $message->user_id;
 }
开发者ID:lavalite,项目名称:message,代码行数:15,代码来源:MessagePolicy.php

示例3: adminDelete

 public function adminDelete(User $user, Role $role)
 {
     if ($user->is($role->id)) {
         $user->detachRole($role);
     }
     return redirect()->back();
 }
开发者ID:emadmrz,项目名称:Hawk,代码行数:7,代码来源:RoleController.php

示例4: destroy

 /**
  * Determine if the given user can delete the given testimonial.
  *
  * @param User $user
  * @param Testimonial $testimonial
  *
  * @return bool
  */
 public function destroy(User $user, Testimonial $testimonial)
 {
     if ($user->canDo('testimonial.testimonial.delete') && $user->is('admin')) {
         return true;
     }
     return $user->id === $testimonial->user_id;
 }
开发者ID:litecms,项目名称:testimonial,代码行数:15,代码来源:TestimonialPolicy.php

示例5: destroy

 /**
  * Determine if the given user can delete the given contact.
  *
  * @param User $user
  * @param Contact $contact
  *
  * @return bool
  */
 public function destroy(User $user, Contact $contact)
 {
     if ($user->canDo('contact.contact.delete') && $user->is('admin')) {
         return true;
     }
     return $user->id === $contact->user_id;
 }
开发者ID:litecms,项目名称:contact,代码行数:15,代码来源:ContactPolicy.php

示例6: destroy

 /**
  * Determine if the given user can delete the given forum.
  *
  * @param User $user
  * @param Forum $forum
  *
  * @return bool
  */
 public function destroy(User $user, Forum $forum)
 {
     if ($user->canDo('forum.forum.delete') && $user->is('admin')) {
         return true;
     }
     return true;
 }
开发者ID:litecms,项目名称:forum,代码行数:15,代码来源:ForumPolicy.php

示例7: destroy

 /**
  * Determine if the given user can delete the given news.
  *
  * @param User $user
  * @param News $news
  *
  * @return bool
  */
 public function destroy(User $user, News $news)
 {
     if ($user->canDo('news.news.delete') && $user->is('admin')) {
         return true;
     }
     return $user->id === $news->user_id;
 }
开发者ID:litecms,项目名称:news,代码行数:15,代码来源:NewsPolicy.php

示例8: destroy

 /**
  * Determine if the given user can delete the given portfolio.
  *
  * @param User $user
  * @param Portfolio $portfolio
  *
  * @return bool
  */
 public function destroy(User $user, Portfolio $portfolio)
 {
     if ($user->canDo('portfolio.portfolio.delete') && $user->is('admin')) {
         return true;
     }
     return $user->id === $portfolio->user_id;
 }
开发者ID:litecms,项目名称:portfolio,代码行数:15,代码来源:PortfolioPolicy.php

示例9: destroy

 /**
  * Determine if the given user can delete the given category.
  *
  * @param User $user
  * @param Category $category
  *
  * @return bool
  */
 public function destroy(User $user, Category $category)
 {
     if ($user->canDo('forum.category.delete') && $user->is('admin')) {
         return true;
     }
     return $user->id === $category->user_id;
 }
开发者ID:litecms,项目名称:forum,代码行数:15,代码来源:CategoryPolicy.php

示例10: destroy

 /**
  * Determine if the given user can delete the given block.
  *
  * @param User $user
  * @param Block $block
  *
  * @return bool
  */
 public function destroy(User $user, Block $block)
 {
     if ($user->canDo('block.block.delete') && $user->is('admin')) {
         return true;
     }
     return $user->id === $block->user_id;
 }
开发者ID:litecms,项目名称:block,代码行数:15,代码来源:BlockPolicy.php

示例11: destroy

 /**
  * Determine if the given user can delete the given task.
  *
  * @param User $user
  * @param Task $task
  *
  * @return bool
  */
 public function destroy(User $user, Task $task)
 {
     if ($user->canDo('task.task.delete') && $user->is('admin')) {
         return true;
     }
     return $user->id === $task->user_id;
 }
开发者ID:lavalite,项目名称:task,代码行数:15,代码来源:TaskPolicy.php

示例12: destroy

 /**
  * Determine if the given user can delete the given resume.
  *
  * @param User $user
  * @param Resume $resume
  *
  * @return bool
  */
 public function destroy(User $user, Resume $resume)
 {
     if ($user->canDo('career.resume.delete') && $user->is('admin')) {
         return true;
     }
     return $user->id === $resume->user_id;
 }
开发者ID:litecms,项目名称:career,代码行数:15,代码来源:ResumePolicy.php

示例13: destroy

 /**
  * Determine if the given user can delete the given faq.
  *
  * @param User $user
  * @param Faq $faq
  *
  * @return bool
  */
 public function destroy(User $user, Faq $faq)
 {
     if ($user->canDo('faq.faq.delete') && $user->is('admin')) {
         return true;
     }
     return $user->id === $faq->user_id;
 }
开发者ID:litecms,项目名称:faq,代码行数:15,代码来源:FaqPolicy.php

示例14: destroy

 /**
  * Determine if the given user can delete the given pricelist.
  *
  * @param User $user
  * @param PriceList $pricelist
  *
  * @return bool
  */
 public function destroy(User $user, PriceList $pricelist)
 {
     if ($user->canDo('pricelist.pricelist.delete') && $user->is('admin')) {
         return true;
     }
     return $user->id === $pricelist->user_id;
 }
开发者ID:litecms,项目名称:pricelist,代码行数:15,代码来源:PriceListPolicy.php

示例15: destroy

 /**
  * Determine if the given user can delete the given gallery.
  *
  * @param User $user
  * @param Gallery $gallery
  *
  * @return bool
  */
 public function destroy(User $user, Gallery $gallery)
 {
     if ($user->canDo('gallery.gallery.delete') && $user->is('admin')) {
         return true;
     }
     return $user->id === $gallery->user_id;
 }
开发者ID:litecms,项目名称:gallery,代码行数:15,代码来源:GalleryPolicy.php


注:本文中的app\User::is方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。