當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::canDo方法代碼示例

本文整理匯總了PHP中app\User::canDo方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::canDo方法的具體用法?PHP User::canDo怎麽用?PHP User::canDo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\User的用法示例。


在下文中一共展示了User::canDo方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: destroy

 /**
  * Determine if the given user can delete the given settings.
  *
  * @param User $user
  * @param Settings $settings
  *
  * @return bool
  */
 public function destroy(User $user, Setting $settings)
 {
     if ($user->canDo('settings.setting.delete')) {
         return true;
     }
     return $user->id === $settings->user_id;
 }
開發者ID:lavalite,項目名稱:settings,代碼行數:15,代碼來源:SettingPolicy.php

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: destroy

 /**
  * Determine if the given user can delete the given team.
  *
  * @param User $user
  * @param Team $team
  *
  * @return bool
  */
 public function destroy(User $user, Team $team)
 {
     if ($user->canDo('team.team.delete') && $user->is('admin')) {
         return true;
     }
     return $user->id === $team->user_id;
 }
開發者ID:litecms,項目名稱:team,代碼行數:15,代碼來源:TeamPolicy.php

示例7: 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

示例8: 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

示例9: destroy

 /**
  * Determine if the given user can delete the given job.
  *
  * @param User $user
  * @param Job $job
  *
  * @return bool
  */
 public function destroy(User $user, Job $job)
 {
     if ($user->canDo('career.job.delete') && $user->is('admin')) {
         return true;
     }
     return $user->id === $job->user_id;
 }
開發者ID:litecms,項目名稱:career,代碼行數:15,代碼來源:JobPolicy.php

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: destroy

 /**
  * Determine if the given user can delete the given page.
  *
  * @param User $user
  * @param Page $page
  *
  * @return bool
  */
 public function destroy(User $user, Page $page)
 {
     if ($user->canDo('page.page.delete')) {
         return true;
     }
     return $user->id === $page->user_id;
 }
開發者ID:Jastkast,項目名稱:Page,代碼行數:15,代碼來源:PagePolicy.php

示例15: 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


注:本文中的app\User::canDo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。