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


PHP Category::create方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     if ($Category = $this->Category->create($request->all())) {
         Flash::success(trans('app.Successful operation'));
         return redirect()->route('dashboard.category.index', ['typeId' => $Category->type_id]);
     } else {
         Flash::error(trans('app.Operation failed'));
         return redirect()->back()->withInput($request->all());
     }
 }
开发者ID:jvlstudio,项目名称:3N1WebSite,代码行数:15,代码来源:CategoryController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CategoryFormRequest $request)
 {
     // Save new category
     Category::create($request->all());
     flash()->success('New category has been added!');
     return redirect('categories');
 }
开发者ID:kakapa,项目名称:erpbox,代码行数:13,代码来源:CategoriesController.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create('it_IT');
     Category::create(['name' => 'News', 'slug' => 'news', 'description' => $faker->paragraph(3)]);
     Category::create(['name' => 'Interviste', 'slug' => 'interviste', 'description' => $faker->paragraph(3)]);
     Category::create(['name' => 'Reportage', 'slug' => 'reportage', 'description' => $faker->paragraph(3)]);
 }
开发者ID:reverserob,项目名称:Blog_Laravel,代码行数:12,代码来源:CategoryTableSeeder.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required|string|max:255|unique:categories', 'parent_id' => 'exists:categories,id']);
     Category::create($request->all());
     \Flash::success('Category saved.');
     return redirect()->route('categories.index');
 }
开发者ID:rawaludin,项目名称:approcket-preproject,代码行数:13,代码来源:CategoriesController.php

示例5: run

 public function run()
 {
     DB::table('categories')->truncate();
     \App\Category::create(['name' => 'Tips & Tutorials', 'slug' => 'tips-tutorials']);
     \App\Category::create(['name' => 'Packages', 'slug' => 'packages']);
     \App\Category::create(['name' => 'Applications', 'slug' => 'apps']);
 }
开发者ID:laravelnews,项目名称:links,代码行数:7,代码来源:CategoryTableSeeder.php

示例6: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(StoreCategoryRequest $request)
 {
     //
     Category::create($request->all());
     $status = 'New category added.';
     return \Redirect::route('categories.index')->with(['status' => $status]);
 }
开发者ID:matthiku,项目名称:LaravelWithSocialite,代码行数:13,代码来源:CategoryController.php

示例7: store

 public function store(CategoryRequest $request)
 {
     $input = $request->all();
     $category = Category::create($input);
     session()->flash('flash_message', 'You have been addded 1 category!');
     return redirect()->route('settings.category');
 }
开发者ID:arooth,项目名称:Library-Management-System,代码行数:7,代码来源:CategoryController.php

示例8: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('tbl_categories')->truncate();
     \App\Category::create(['category' => 'Clothes']);
     \App\Category::create(['category' => 'Miscellaneous']);
     \App\Category::create(['category' => 'Music']);
 }
开发者ID:justmemaarten,项目名称:vlambeer,代码行数:12,代码来源:CategoryTableSeeder.php

示例9: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('locations')->truncate();
     Location::create(['name' => 'Phase 1, Level 1']);
     Location::create(['name' => 'Phase 1, Level 2']);
     Location::create(['name' => 'Phase 1, Level 3']);
     Location::create(['name' => 'Phase 2, Level 1']);
     Location::create(['name' => 'Phase 2, Level 2']);
     Location::create(['name' => 'Phase 2, Level 3']);
     Location::create(['name' => 'Phase 3, Level 1']);
     Location::create(['name' => 'Phase 3, Level 2']);
     Location::create(['name' => 'Phase 3, Level 3']);
     DB::table('areas')->truncate();
     Area::create(['name' => 'AME']);
     Area::create(['name' => 'M&W']);
     Area::create(['name' => 'Ramp']);
     Area::create(['name' => 'SCI']);
     Area::create(['name' => 'Tool Install']);
     DB::table('categories')->truncate();
     Category::create(['name' => 'Spec Gas']);
     Category::create(['name' => 'Electrical']);
     Category::create(['name' => 'Base Build']);
     Category::create(['name' => 'Design Request']);
     Category::create(['name' => 'Layout Optimization']);
     Category::create(['name' => 'Safety']);
     DB::table('status')->truncate();
     Status::create(['name' => 'New', 'slug' => 'new']);
     Status::create(['name' => 'Open/Needs Further Review', 'slug' => 'open-needs-further-review']);
     Status::create(['name' => 'Waiting for Approval', 'slug' => 'waiting-for-approval']);
     Status::create(['name' => 'Rejected', 'slug' => 'rejected']);
     Status::create(['name' => 'Approved', 'slug' => 'approved']);
 }
开发者ID:gfdeveloper,项目名称:LCCB,代码行数:37,代码来源:RandomTableSeeder.php

示例10: run

 public function run()
 {
     DB::table('categories')->delete();
     Category::create(array('id' => 3, 'created_at' => '2015-11-09 16:10:46', 'updated_at' => '2015-11-09 16:10:46', 'name' => 'Fruits'));
     Category::create(array('id' => 4, 'created_at' => '2015-11-09 16:11:39', 'updated_at' => '2015-11-09 16:11:39', 'name' => 'Vegetables'));
     Category::create(array('id' => 5, 'created_at' => '2015-11-09 16:13:46', 'updated_at' => '2015-11-09 16:13:46', 'name' => 'Grains'));
 }
开发者ID:edgars-supe,项目名称:wt2-hw2,代码行数:7,代码来源:DatabaseSeeder.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|unique:categories|max:255', 'color' => 'required']);
     $category = Category::create(['name' => $request->get('name'), 'slug' => str_slug($request->get('name')), 'description' => $request->get('description'), 'color' => $request->get('color')]);
     $message = $category ? 'Categoria agregada correctamente!' : 'La categoria NO pudo agregarse!';
     return redirect()->route('admin.category.index')->with('message', $message);
 }
开发者ID:kazamax,项目名称:tienda,代码行数:13,代码来源:CategoryController.php

示例12: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, $this->rules);
     $input = Input::all();
     Category::create($input);
     return Redirect::route('categories.index')->with('message', 'New category created!');
 }
开发者ID:lamwin,项目名称:laravel-blog,代码行数:12,代码来源:CategoriesController.php

示例13: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     foreach (range(1, 10) as $index) {
         Category::create(['title' => $faker->sentence, 'description' => $faker->paragraph(1), 'parent_id' => NULL, 'created_by' => 1, 'updated_by' => 1, 'ordering' => 1, 'status' => true]);
     }
 }
开发者ID:TEACHER-KEAK,项目名称:GAD,代码行数:12,代码来源:CategoryTableSeeder.php

示例14: run

 public function run()
 {
     DB::table('categories')->delete();
     Category::create(array('name' => 'Category 1'));
     Category::create(array('name' => 'Category 2'));
     Category::create(array('name' => 'Category 3'));
 }
开发者ID:starmatt,项目名称:webpapa,代码行数:7,代码来源:CategoriesTableSeeder.php

示例15: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CategoryRequest $request)
 {
     Category::create($request->all());
     flash()->success('Your category has been created!');
     \Cache::tags('categories')->flush();
     return redirect('admin/categories/index');
 }
开发者ID:kpaxer,项目名称:laravel-blog,代码行数:12,代码来源:CategoriesController.php


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