当前位置: 首页>>代码示例>>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;未经允许,请勿转载。