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


PHP app\Category類代碼示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param Category $category
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request, Category $category)
 {
     $this->validate($request, ['name' => 'required|unique:categories', 'slug' => 'required|unique:categories']);
     $input = $request->except(['_token']);
     $category->fill($input)->save();
     return redirect('categories')->with('success', $category->name . ' category successfully added.');
 }
開發者ID:jimmygle,項目名稱:accounting,代碼行數:14,代碼來源:CategoriesController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $category = new Category();
     $category->name = $request->name;
     $category->save();
     return redirect('movie');
 }
開發者ID:kevinrefvik,項目名稱:MovieCatalogue,代碼行數:13,代碼來源:CategoryController.php

示例3: postComment

 public function postComment(Category $category, Post $post, CommentRepository $repository, PostNewComment $request, Comment $comment)
 {
     $fields = array_merge($request->all(), array('post_id' => $post->id));
     $comment->create($fields);
     Session::flash('success', 'Comment added succesfully !');
     return view('blog.post', ['post' => $post, 'categories' => $category->all()]);
 }
開發者ID:bigpaulie,項目名稱:demo-laravel-blog,代碼行數:7,代碼來源:BlogController.php

示例4: index

 /**
  * Display a listing of categories and the category members (parent-children) and their social media.
  *
  * @return Response
  */
 public function index($slug)
 {
     // get links in footer
     $linksArr = \App\Links::orderBy('rank', 'ASC')->lists('link', 'name');
     if ($slug != 'all') {
         $catObj = Category::whereSlug($slug)->first();
         if (is_null($catObj)) {
             \Session::flash('message', 'Invalid category');
             return redirect('/socialmedia/all');
         }
         $catPathArr = $catObj->getCategoryPath($slug);
         $catArr = $catObj->getChildren($catObj->id);
     } else {
         $catPathArr = array();
         $catObj = new Category();
         $catArr = $catObj->getParents();
     }
     $getChildren = $this->getChildrenBool($catPathArr, $slug, $catObj);
     // eg. get the teammates on the Lakers, don't get teams in the Pacific Coast division
     if ($getChildren) {
         $memberArr = $this->memberObj->getMembersWithinSingleCategory($catObj->id);
         list($memberArr, $contentArr) = $this->memberSocialObj->getSocialMediaWithMemberIds($memberArr);
         return view('socialmedia.child', compact('memberArr', 'contentArr', 'catPathArr', 'linksArr'));
     } else {
         $parentArr['contentArr'] = [];
         foreach ($catArr as $catId => $catName) {
             $memberArr = $this->memberObj->getMembersWithinSingleCategory($catId);
             $tmpMemberArr = array($memberArr[0]);
             list(, $contentArr) = $this->memberSocialObj->getSocialMediaWithMemberIds($tmpMemberArr);
             $parentArr['memberArr'][$catId] = $memberArr;
             $parentArr['contentArr'] = $parentArr['contentArr'] + $contentArr;
         }
         return view('socialmedia.parent', compact('parentArr', 'catArr', 'catPathArr', 'linksArr'));
     }
 }
開發者ID:nowarena,項目名稱:homestead,代碼行數:40,代碼來源:SocialMediaController.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $category = new Category();
     $category->category_name = $request->category_name;
     $category->save();
     \Session::flash('success', 'Category created successfully');
 }
開發者ID:pius-ng3a,項目名稱:go_orderdeliver,代碼行數:13,代碼來源:CategoryController.php

示例6: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $category1 = new Category();
     $category1->name = 'Cat 1';
     $category1->save();
     $category2 = new Category();
     $category2->name = 'Cat 2';
     $category2->save();
     $nice_action = new NiceAction();
     $nice_action->name = 'Greet';
     $nice_action->niceness = 3;
     $nice_action->save();
     $category1->nice_actions()->attach($nice_action);
     $category2->nice_actions()->attach($nice_action);
     $nice_action = new NiceAction();
     $nice_action->name = 'Hug';
     $nice_action->niceness = 6;
     $nice_action->save();
     $category2->nice_actions()->attach($nice_action);
     $nice_action = new NiceAction();
     $nice_action->name = 'Kiss';
     $nice_action->niceness = 12;
     $nice_action->save();
     $category1->nice_actions()->attach($nice_action);
     $nice_action = new NiceAction();
     $nice_action->name = 'Wave';
     $nice_action->niceness = 2;
     $nice_action->save();
     $category2->nice_actions()->attach($nice_action);
 }
開發者ID:pedreyesjr,項目名稱:test,代碼行數:35,代碼來源:NiceActionSeeder.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $category = new Category();
     $category->name = Input::get('name');
     $category->under_category = Input::get('under_category');
     $category->save();
     return redirect()->route('category-list');
 }
開發者ID:rashed008,項目名稱:laravel-5,代碼行數:13,代碼來源:CategoryController.php

示例8: store

 public function store(CategoryFormRequest $request)
 {
     $category = new Category(['name' => $request->get('name')]);
     $category->save();
     return redirect('admin/categories/create')->with('status', 'A new category has been created!');
     //        Session::flash('status', 'A new category has been created!');
     //        return view('backend.categories.create');
 }
開發者ID:corean,項目名稱:LearningLaravel,代碼行數:8,代碼來源:CategoriesController.php

示例9: categorylist

 /**
  * List of categories in parent - child hierarchy
  * 
  * @return Response
  */
 public function categorylist()
 {
     $categoryPAndCObj = new \App\CategoryParentAndChildren();
     $category = new \App\Category();
     $categoriesObj = $category->all();
     $categoriesArr = $category->getCategoriesArr($categoriesObj);
     $parentChildArr = $categoryPAndCObj->getHierarchy();
     return view('socialmedia.categorylist', compact('categoriesObj', 'parentChildArr', 'categoriesArr'));
 }
開發者ID:nowarena,項目名稱:homestead,代碼行數:14,代碼來源:SocialMediaController.php

示例10: delete

 public function delete(Request $request, Category $category)
 {
     $category->delete();
     if ($request->isXmlHttpRequest()) {
         return response(json_encode(['success' => true]))->header('Content-type', 'application/json');
     } else {
         return redirect('/category');
     }
 }
開發者ID:rajinha92,項目名稱:laravel-skills-test2,代碼行數:9,代碼來源:CategoryController.php

示例11: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $categories = ['Safari', 'Safari Adventure', 'Cruise / Boats', 'City Tours', 'Bus Tours', 'Air Tours', 'Fishing & Yachting', 'Water Parks / Entertainment', 'UAE Attractions', 'Shopping Malls', 'Souks'];
     foreach ($categories as $category) {
         $new_category = new Category();
         $new_category->name = $category;
         $new_category->save();
     }
 }
開發者ID:marktimbol,項目名稱:eclipse,代碼行數:14,代碼來源:CategoryTableSeeder.php

示例12: update

 public function update(Request $request)
 {
     $category = new Category();
     $category->id = $request->id;
     $category->name = $request->name;
     $category->save();
     echo json_encode(true);
     exit;
 }
開發者ID:xstation1021,項目名稱:LaravelAngular,代碼行數:9,代碼來源:CategoryController.php

示例13: postAdd

 public function postAdd(Request $request)
 {
     $data = $request->all();
     $rules = $rules = array('category' => 'required|min:3|max:200|unique:categories,name');
     $this->validate($request, $rules);
     $category = new Category();
     $category->name = $data['category'];
     $category->save();
     return redirect('admin')->withMessage('Category added!');
 }
開發者ID:edgars-supe,項目名稱:wt2-hw2,代碼行數:10,代碼來源:CategoryController.php

示例14: store

 /**
  * Store the new category
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required|max:32|min:3', 'description' => 'max:128|min:3'], ['title.*' => 'หัวข้อต้องมีความยาว 3-32 ตัวอักษร', 'description.*' => 'คำบรรยายต้องมีความยาว 3-128 ตัวอักษร']);
     $category = new App\Category();
     $category->title = $request->title;
     $category->description = $request->description;
     $category->status = 1;
     $category->save();
     return redirect()->action('CategoryController@create');
 }
開發者ID:theballkyo,項目名稱:zgm-mc-web,代碼行數:16,代碼來源:CategoryController.php

示例15: getEdit

 public function getEdit($id)
 {
     $categories = new Category();
     $allCategory = $categories->getCategoriesDropDown();
     $branches = new Branch();
     $branchAll = $branches->getBranchesDropDown();
     $subCategories = new SubCategory();
     $allSubCategory = $subCategories->getSubCategoriesDropDown();
     $products = Product::find($id);
     return view('Products.edit', compact('branchAll'))->with('products', $products)->with('categoryAll', $allCategory)->with('subCategoryAll', $allSubCategory);
 }
開發者ID:woakes070048,項目名稱:cemcoErp,代碼行數:11,代碼來源:ProductController.php


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