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


PHP Category::fill方法代码示例

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


在下文中一共展示了Category::fill方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $category = new Category();
     $category->fill($request->all());
     $image = $request->file('image');
     $imageName = "";
     if ($image->isValid()) {
         $path = public_path() . '/uploads/category/';
         $imageName = str_random(32) . '.' . $image->getClientOriginalExtension();
         $image->move($path, $imageName);
     } else {
         App::abort(404);
     }
     $small_image = $request->file('small_image');
     $imageNamesmall = "";
     if ($small_image->isValid()) {
         $path = public_path() . '/uploads/category/';
         $imageNamesmall = str_random(32) . '.' . $small_image->getClientOriginalExtension();
         $small_image->move($path, $imageNamesmall);
     } else {
         App::abort(404);
     }
     $category->image = $imageName;
     $category->small_image = $imageNamesmall;
     $category->save();
     return Redirect::route('admin.category.show');
 }
开发者ID:nikajorjika,项目名称:gamoiwere.ge,代码行数:33,代码来源:CategoryController.php

示例3: update

 /**
  * Update the specified resource in storage.
  *
  */
 public function update(Request $request, Category $category)
 {
     $category->fill($request->all());
     $category->slug = str_slug($request->get('name'));
     $updated = $category->save();
     $message = $updated ? 'Categoria actualizada' : 'Error al actualizar';
     return redirect()->route('admin.category.index')->with('message', $message);
 }
开发者ID:aleksAE,项目名称:Store-Laravel5.1,代码行数:12,代码来源:CategoryController.php

示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, Category $category)
 {
     $category->fill($request->all());
     $category->slug = str_slug($request->get('name'));
     $updated = $category->save();
     $message = $updated ? 'Category was updated succesfully' : 'Could not update the new category';
     return redirect()->route('admin.category.index')->with('message', $message);
 }
开发者ID:AcarMeel,项目名称:store,代码行数:14,代码来源:CategoryController.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @param CreateCategoryRequest $request
  * @return Response
  */
 public function store(CreateCategoryRequest $request)
 {
     $category = new Category();
     $category->fill($request->all());
     $category->save();
     $message = trans('messages.category_created_successfully');
     Flash::success($message);
     return redirect()->route('admin.categories.index');
 }
开发者ID:jrafaelca,项目名称:infrea,代码行数:15,代码来源:CategoriesController.php

示例6: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, Category $category)
 {
     $this->validate($request, ['name' => 'required|max:255', 'color' => 'required']);
     $category->fill($request->all());
     $category->slug = str_slug($request->get('name'));
     $updated = $category->save();
     $message = $updated ? 'Categoría actualizada correctamente!' : 'La Categoría NO pudo actualizarse!';
     return redirect()->route('admin.category.index')->with('message', $message);
 }
开发者ID:primitivorm,项目名称:tienda,代码行数:15,代码来源:CategoryController.php

示例7: pushCategory

 /**
  *  Create a new category from request.
  *
  * @param $request input form data
  * @return User
  */
 public function pushCategory($request)
 {
     $input = $request->all();
     if (isset($input['name'])) {
         $input['slug'] = str_slug($input['name'], "-");
     }
     $category = new Category();
     $category->fill($input);
     $category->save();
     return $category;
 }
开发者ID:blyp,项目名称:blyp.api,代码行数:17,代码来源:Category.php

示例8: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     // $dropbox = Dropbox::createTemporaryDirectLink("/web/test.jpg");
     //
     // return $dropbox;
     $this->validate($request, ['slug' => 'unique:categories,slug', 'name' => 'required', 'description' => 'required']);
     $category = new Category();
     $category->fill($request->all());
     if ($request->hasFile('featured_image')) {
         $file = $request->file('featured_image');
         $timestamp = str_replace([' ', ':'], '-', Carbon::now()->toDateTimeString());
         $name = $timestamp . '.' . $file->getClientOriginalExtension();
         $path = "/web/categories/";
         $dropbox = Dropbox::uploadFileFromString($path . $name, Dropbox\WriteMode::add(), file_get_contents($request->file('featured_image')->getRealPath()));
         $category->featured_image = $dropbox['path'];
     }
     $category->save();
     Session::flash('flash_message', 'Flokkurinn var vistaður');
     return redirect()->back();
 }
开发者ID:dadigu,项目名称:haskolabru,代码行数:26,代码来源:CategoriesController.php

示例9: update

 /**
  * Updates Category into database
  *
  * @param Category $category
  * @param array $input
  *
  * @return Category
  */
 public function update($category, $input)
 {
     $category->fill($input);
     $category->save();
     return $category;
 }
开发者ID:ambarsetyawan,项目名称:laravel5-demo,代码行数:14,代码来源:CategoryRepository.php

示例10: update

 /**
  * Update the specified category in storage.
  *
  * @param Category $category
  * @param CategoryRequest $request
  * @return Response
  */
 public function update(Category $category, CategoryRequest $request)
 {
     $category->fill($request->all());
     $category->save() ? Flash::success(trans('admin.update.success')) : Flash::error(trans('admin.update.fail'));
     return redirect(route('admin.category.index'));
 }
开发者ID:ungly,项目名称:laravel-5-simple-cms,代码行数:13,代码来源:CategoryController.php


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