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


PHP Category::accessable方法代碼示例

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


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

示例1: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, \App\Menu $menu, \App\Category $category)
 {
     $validation = \Validator::make($request->all(), ['name' => 'min:3']);
     if ($validation->fails()) {
         return response($validation->errors()->all(), 400);
     }
     if ($category->accessable($menu)) {
         $category->update($request->all());
         $category->savePhoto($request->file('photo'));
         return $category;
     }
 }
開發者ID:halidovz,項目名稱:restful,代碼行數:19,代碼來源:MenuCategoryController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request, \App\Menu $menu, \App\Category $category)
 {
     $validation = \Validator::make($request->all(), ['name' => 'required|min:3', 'price' => 'required|integer|min:1']);
     if ($validation->fails()) {
         return response($validation->errors()->all(), 400);
     }
     if ($category->accessable($menu)) {
         $food = new \App\Food($request->all());
         $category->foods()->save($food);
         $food->savePhotos(['photos' => $request->file('photos'), 'remove_photos' => $request->get('remove_photos'), 'main_photo' => $request->get('main_photo')]);
         return $food;
     }
 }
開發者ID:halidovz,項目名稱:restful,代碼行數:19,代碼來源:CategoryFoodController.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(\App\Category $category)
 {
     if ($category->accessable()) {
         return $category->foods;
     }
 }
開發者ID:halidovz,項目名稱:restful,代碼行數:11,代碼來源:ClientCategoryFoodController.php

示例4: accessable

 public function accessable(\App\Menu $menu, \App\Category $category)
 {
     return $category->id == $this->category_id && $category->accessable($menu);
 }
開發者ID:halidovz,項目名稱:restful,代碼行數:4,代碼來源:Food.php


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