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


PHP Project::fill方法代码示例

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


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

示例1: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  App\Http\Request\Request
  * @param  App\Project $project
  * @return Response
  */
 public function update(Request $request, Project $project)
 {
     $this->validate($request, ['nama_project' => 'required', 'nama_lembaga' => 'required', 'tanggal_mulai' => 'required|date', 'tanggal_selesai' => 'required|date|after:' . $request->input('tanggal_mulai'), 'alamat' => 'required']);
     $input = $request->all();
     $project->fill($input)->save();
     return redirect('/project')->with('success', 'Sukses memperbarui proyek ' . $input['nama_project'] . '.');
 }
开发者ID:nugi,项目名称:SI_Dinas,代码行数:15,代码来源:ProjectController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $validator = $this->validateName();
     if ($validator->fails()) {
         return $validator->errors()->all();
     }
     $instance = new Project();
     $instance->fill($request->all());
     return Auth::user()->projects()->save($instance);
 }
开发者ID:RoM4iK,项目名称:taskman,代码行数:16,代码来源:projectsController.php

示例3: update

 /**
  * Update the specified resource in storage.
  *
  * @param  ProjectRequest  $request
  * @param  Project  $project
  * @return Response
  */
 public function update(ProjectRequest $request, Project $project)
 {
     $data = $request->all();
     $data['images'] = $project->images ? $project->images : [];
     $i = 0;
     $files = json_decode($data['files_deleted']);
     foreach ($files as $file) {
         if (($key = array_search($file, $data['images'])) !== false) {
             unset($data['images'][$key]);
             $this->delete($file);
         }
     }
     foreach ($_FILES['images']['tmp_name'] as $tmpPath) {
         if (!empty($tmpPath)) {
             $fileUpload = $this->upload($tmpPath, $i++);
             array_push($data['images'], $fileUpload);
         }
     }
     // Hàm unset() khiến key của array ko còn là dãy số liên tiếp
     // Lúc này Laravel sẽ ko đối xử và lưu 'images' như kiểu array mà là kiểu Json, cần sửa chữa vấn đề này
     $data['images'] = array_values($data['images']);
     $project->fill($data)->save();
     return redirect('m/danh-sach-nha-dat/du-an')->with('flash_message', Lang::get('system.update'));
 }
开发者ID:khanhpnk,项目名称:sbds,代码行数:31,代码来源:ProjectController.php

示例4: SaveProject

 public function SaveProject(Request $request)
 {
     $project = new Project();
     $project->fill($request->except('_token', 'submitBtn'));
     $project->save();
     $member = Member::find($request->get('member_id'));
     if ($request->get('submitBtn') == 'save') {
         return redirect()->route('thank.you');
     }
     return back()->withMember($member)->withMessage('project saved');
 }
开发者ID:bikundo,项目名称:members,代码行数:11,代码来源:MembersController.php


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