本文整理汇总了PHP中app\Project::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::update方法的具体用法?PHP Project::update怎么用?PHP Project::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Project
的用法示例。
在下文中一共展示了Project::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param \App\Project $project
* @return Response
*/
public function update(Project $project, Request $request)
{
$this->validate($request, $this->rules);
$input = array_except(Input::all(), '_method');
$project->update($input);
return Redirect::route('projects.show', $project->slug)->with('message', 'Project updated.');
}
示例2: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param Project $project
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Project $project)
{
$input = array_except(Input::all(), '_method');
$project->update($input);
Session::flash('flash_message', 'Project updated successfully!');
return Redirect::route('projects.index')->with('message', 'Project created');
}
示例3: update
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int Project $project
* @return Response
*/
public function update(Request $request, Project $project)
{
//
$input = array_except(Input::all(), '_method');
$project->update($input);
return Redirect::route('projects.show', $project->slug)->with('message', 'Project updated.');
}
示例4: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Project $project, ProjectRequest $request)
{
//
$input = $request->all();
$project->update($input);
return redirect('proyectos');
}
示例5: update
public function update(Project $project, ProjectRequest $request)
{
//Client $client refrences a Route Model Binding method found is RouteServiceProvider.php
$project->update($request->all());
\Session::flash('flash_message', 'Project ' . $project->project_name . ' was updated.');
return redirect('projects');
}
示例6: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Project $project)
{
$this->validate($request, $this->rules);
$input = $request->except('_method');
$input['slug'] = str_slug($request->name, '-');
$project->update($input);
return Redirect::route('projects.show', $project->slug)->with('message', 'Project updated.');
}
示例7: testUpdateProjectName
/**
* @depends testCreateEmptyProject
* @param Project $project
*/
function testUpdateProjectName(Project $project)
{
$this->_userLoginIn();
$old_name = $project->name;
$project->update(['name' => "New project name"]);
$this->assertNotEquals($old_name, $project->name);
$this->assertEquals(1, $project->activity()->get()->count());
}
示例8: update
/**
* Update the specified resource in storage.
*
* @param \App\Project $project
* @return Response
*/
public function update(Project $project, Request $request)
{
// Validate the request before continuing...
$this->validate($request, $this->rules);
$input = array_except(Input::all(), array('_method', 'slug'));
$project->update($input);
return Redirect::route('projects.show', $project->slug)->with('message', 'Project updated.');
}
示例9: saveProject
/**
* Save a project from a POST request
*
* @param Project $project
* @param Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function saveProject(Project $project, Request $request)
{
$params = $this->filterRequest($request);
if ($project->update($params)) {
return redirect()->back()->with('status', '工程已更新!');
} else {
return redirect()->back()->with('status', '工程更新出错!');
}
}
示例10: update
/**
* Update the specified resource in storage.
*
* @param \App\Project $project
* @return Response
*/
public function update(Project $project, Request $request)
{
$validator = Validator::make($request->all(), ['name' => 'required|min:3|max:255', 'slug' => 'required|min:3|max:255']);
if ($validator->fails()) {
return redirect()->back()->withInput()->withErrors($validator);
}
//
$input = array_except(Input::all(), '_method');
$project->update($input);
return Redirect::route('projects.show', $project->slug)->with('message', 'Success: Your Project updated.');
}
示例11: patchEditProject
/**
* Approve the project, whilst updating any changes the Administrator has made.
*
* @param AdminEditProjectRequest $request
* @param Project $project
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function patchEditProject(AdminEditProjectRequest $request, Project $project)
{
$originalChildName = $project->child_name;
$originalSlug = $project->slug;
// Update the Project, if the Admin has altered the content.
$project->update($request->all());
// Update the slug, if altered.
$project->slug = strtolower(preg_replace('/[\\s-]+/', '-', $request->get('project_name')));
// Approve the project, and make it live.
$project->approved = '1';
$project->live = '1';
// Set the time for project to end.
$date = Carbon::now();
$date->day = $date->day + 60;
$project->completed_on = $date->toDateString();
$project->save();
// If the Administrator renames the project, we need new directories.
$this->makeDocumentDirectory(public_path('documents/' . $project->slug));
$this->makeImageDirectories(public_path('img/' . $project->slug));
// In the instance the Administrator amends the child's name, project name, or both
// Rename and move the project's images, move the project's documents.
if ($project->child_name != $originalChildName || $project->slug != $originalSlug) {
for ($i = 0; $i < count($project->images); $i++) {
$extension = explode('.', $project->images[$i]->filename);
$extension = $extension[count($extension) - 1];
$filename = strtolower(preg_replace('/[\\s]+/', '_', $project->child_name)) . ($i + 1) . '.' . $extension;
$orginalDirectory = public_path('img/' . $originalSlug);
$newDirectory = public_path('img/' . $project->slug);
// Small image.
$image = file_get_contents($orginalDirectory . '/small/' . $project->images[$i]->filename);
file_put_contents($newDirectory . '/small/' . $filename, $image);
// Medium image.
$image = file_get_contents($orginalDirectory . '/medium/' . $project->images[$i]->filename);
file_put_contents($newDirectory . '/medium/' . $filename, $image);
// Large image.
$image = file_get_contents($orginalDirectory . '/large/' . $project->images[$i]->filename);
file_put_contents($newDirectory . '/large/' . $filename, $image);
// Update the Image Model.
$project->images[$i]->filename = $filename;
$project->images[$i]->save();
}
// Move the documents.
foreach ($project->documents as $document) {
$file = file_get_contents(public_path('documents/' . $originalSlug . '/' . $document->filename));
file_put_contents(public_path('documents/' . $project->slug . '/' . $document->filename), $file);
}
}
// Redirect to Admin panel.
Session::flash('flash_message', trans('adminpanel.approved-message'));
return redirect('admin');
}
示例12: update
/**
* Update the specified resource in storage.
*
* @param ProjectRequest $request
* @param Project $project
* @return \Illuminate\Http\Response
*/
public function update(ProjectRequest $request, Project $project)
{
$project->update($request->all());
$project->save();
return redirect()->route('project.show', [$project]);
}
示例13: update
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param Project $project
* @return Response
*/
public function update(Request $request, Project $project)
{
$project->update($request->all());
return $this->show($project);
}
示例14: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
//
$rules = array('projectNum' => 'required', 'create_at' => 'required', 'pjsales' => 'required', 'pjContacter' => 'required', 'pjContacterPhone' => 'required', 'pjContacterEmail' => 'email|required', 'cmCode' => 'required', 'cmShort' => 'required', 'e_shortName' => 'required', 'customer_id' => 'required', 'c_name' => 'required', 'institute' => 'required', 'department' => 'required', 'email' => 'email|required', 'contacter' => 'required', 'contacterPhone' => 'required', 'contacterEmail' => 'email|required', 'address' => 'required', 'sales' => 'required', 'PJclass' => 'required', 'PJservice' => 'required', 'PJspecies' => 'required');
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
return back()->withErrors($validator)->withInput();
}
$customer_id = $request->get('customer_id');
if ($customer_id == 0) {
$customer = new Customer(array('cmCode' => $request->get('cmCode'), 'cmShort' => $request->get('cmShort'), 'c_name' => $request->get('c_name'), 'e_shortName' => $request->get('e_shortName'), 'institute' => $request->get('institute'), 'department' => $request->get('department'), 'fax' => $request->get('fax'), 'phone' => $request->get('phone'), 'email' => $request->get('email'), 'contacter' => $request->get('contacter'), 'contacterPhone' => $request->get('contacterPhone'), 'contacterEmail' => $request->get('contacterEmail'), 'address' => $request->get('address'), 'salesman' => $request->get('sales')));
$salesman = User::findOrFail($request->get('sales'));
$customer->salesman()->associate($salesman);
$customer->save();
$last = DB::table('customers')->orderBy('created_at', 'desc')->first();
$customer_id = $last->id;
} else {
$customer = Customer::findOrFail($customer_id);
$customer->update(['cmCode' => $request->get('cmCode'), 'cmShort' => $request->get('cmShort'), 'c_name' => $request->get('c_name'), 'e_shortName' => $request->get('e_shortName'), 'institute' => $request->get('institute'), 'department' => $request->get('department'), 'fax' => $request->get('fax'), 'phone' => $request->get('phone'), 'email' => $request->get('email'), 'contacter' => $request->get('contacter'), 'contacterPhone' => $request->get('contacterPhone'), 'contacterEmail' => $request->get('contacterEmail'), 'address' => $request->get('address')]);
$salesman = User::findOrFail($request->get('sales'));
$customer->salesman()->associate($salesman);
$customer->save();
}
if ($request->get('PJservice') == 'Others') {
$PJservice = $request->get('PJserviceNote');
} else {
$PJservice = $request->get('PJservice');
}
$project = new Project(array('projectNum' => $request->get('projectNum'), 'PJtype' => $request->get('PJtype'), 'PJclass' => $request->get('PJclass'), 'PJservice' => $PJservice, 'PJspecies' => $request->get('PJspecies'), 'note' => $request->get('note'), 'contacter' => $request->get('contacter'), 'contacterPhone' => $request->get('contacterPhone'), 'contacterEmail' => $request->get('contacterEmail'), 'status' => '新建'));
$user = \Auth::user();
$project->user()->associate($user);
$customer = Customer::findOrFail($customer_id);
$project->customer()->associate($customer);
$pjsalesman = User::findOrFail($request->get('pjsales'));
$project->salesman = $pjsalesman->id;
$project->save();
if (empty($request->file('file'))) {
$fileName = null;
} else {
$fileName = $project->id . '.' . $request->file('file')->getClientOriginalExtension();
$request->file('file')->move(base_path() . '/storeFiles/ngs/quotation/', $fileName);
}
$project->update(['fileName' => $fileName]);
return \Redirect::to('research/ngs/projects/index')->with('message', 'Your Project has been created!');
}
示例15: update
public function update(Project $project, ProjectRequest $request)
{
$project->update(['id' => $request->get('id'), 'name' => $request->get('name'), 'excerpt' => $request->get('excerpt'), 'description' => $request->get('description'), 'github' => $this->convertToAbsoluteUrl($request->get('github')), 'date_created' => $request->get('date_created'), 'important' => $request->get('important') ? true : false]);
$this->saveImage($project, $request);
return redirect("projects/{$project->id}");
}