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


PHP Project::save方法代码示例

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


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

示例1: store

 public function store(Request $request)
 {
     $project = new Project();
     $project->title = $request->input('title');
     $project->sender_host = $_SERVER['REMOTE_ADDR'];
     $project->status = 'undefined';
     $project->extension = $request->input('extension');
     $render_string = $request->input('args');
     if ($request->has('bitrate')) {
         $bt = $request->input('bitrate');
         if (strpos($render_string, '%bitrate') != false) {
             $render_string = str_replace('%bitrate', $bt, $render_string);
         } else {
             if (strpos($render_string, '%quality') != false) {
                 $render_string = str_replace('%quality', $bt, $render_string);
             }
         }
     }
     if ($request->has('audiobitrate')) {
         $at = $request->input('audiobitrate');
         if (strpos($render_string, '%audiobitrate') != false) {
             $render_string = str_replace('%audiobitrate', $at, $render_string);
         } else {
             if (strpos($render_string, '%audioquality') != false) {
                 $render_string = str_replace('%audioquality', $at, $render_string);
             }
         }
     }
     if ($request->has('passes')) {
         $p = $request->input('passes');
         if (strpos($render_string, '%passes') != false) {
             $render_string = str_replace('%passes', $p, $render_string);
         }
     }
     $project->render_string = $render_string;
     $project->save();
     $test = false;
     if ($request->hasFile('mlt') && $request->file('mlt')->isValid()) {
         /*
         	For the sake of prudency, after mkdir(0777) I enforce another
         	chmod(0777) on the folder (required for the correct execution of melt)
         */
         mkdir($project->folder(), 0777);
         chmod($project->folder(), 0777);
         if ($request->file('mlt')->move($project->folder(), 'config.mlt')) {
             $this->dispatch(new TestJob($project));
             $test = true;
         }
     }
     if ($test == false) {
         $project->status = 'failed';
         $project->save();
     }
     return redirect(url('/'));
 }
开发者ID:OfficineDigitali,项目名称:pasolino,代码行数:55,代码来源:MainController.php

示例2: saveProject

 /**
  * Store a newly created Project in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function saveProject(Request $request)
 {
     // Validation for Add Project form
     $this->validate($request, ['title' => 'required', 'slug' => 'required|unique:projects', 'excerpt' => 'required', 'body' => 'required', 'thumbnail' => 'required', 'list' => 'required', 'pusblished' => 'boolean']);
     // Set all required fields for adding into the database
     $project = new Project();
     $project->title = $request->title;
     $project->slug = $request->slug;
     $project->excerpt = $request->excerpt;
     $project->body = $request->body;
     $project->link = $request->link;
     $project->href = $request->href;
     // Check if published field is selected set it to 1, overwise set it to 0 (because default unchecked value is NULL)
     $project->published = $request->published ? 1 : 0;
     // Checking if there is a file in request
     if ($request->hasFile('thumbnail')) {
         $file = $request->file('thumbnail');
         $thumbName = uniqid() . '-' . $file->getClientOriginalName();
         $projectPath = 'build/images/projects/' . $project->slug . '/';
         if (!file_exists($projectPath)) {
             Storage::disk('public')->makeDirectory($projectPath);
         }
         $thumb = Image::make($request->file('thumbnail')->getRealPath());
         $thumb->fit(720, 520, function ($constraint) {
             $constraint->upsize();
         })->save($projectPath . $thumbName);
         // set the thumbnail field into the database
         $project->thumbnail = $thumbName;
     }
     $project->save();
     // Add project roles to current project in pivot table.
     $project->projectRoles()->sync($request->list);
     return redirect()->back();
 }
开发者ID:harequ,项目名称:redesign-laravel,代码行数:40,代码来源:ProjectsController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     //
     $project = new Project($request->all());
     $project->save();
     return $project;
 }
开发者ID:urbanix,项目名称:contract-payments-demo,代码行数:12,代码来源:ProjectController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //get all project inputs from the post
     $inputs = $request->all();
     if ($inputs['color']) {
         /*
          *
          *      Handle adding sort order to projects. "sort"
          *      column in projects table.  Get max sort # 
          *      then add 1 for the sort column value. 
          *    
          */
         //gets the max order number from projects table.
         $max_project_sort = Project::max('order');
         $order_number = null;
         if ($max_project_sort) {
             $order_number = $max_project_sort + 1;
         } else {
             $order_number = 1;
         }
         $project = new Project();
         //this is a global way to access the auth class.
         $user = auth()->user();
         $project->name = $inputs['name'];
         $project->color = $inputs['color'];
         $project->completed = 0;
         $project->user_id = $user->id;
         $project->order = $order_number;
         $project->save();
         return redirect($inputs['referrer']);
     } else {
     }
 }
开发者ID:Ryan8765,项目名称:projectorganizer,代码行数:39,代码来源:ProjectsController.php

示例5: postCreate

 public function postCreate(Request $request)
 {
     $item = new Project();
     $item->title = "New Project";
     $item->save();
     return redirect('/projects');
 }
开发者ID:metreniuk,项目名称:campsoup,代码行数:7,代码来源:ProjectMainController.php

示例6: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $project = new Project();
     $project->title = $request->title;
     $directory = public_path() . '/' . $request->title;
     \File::makeDirectory($directory);
     $project->description = $request->description;
     $project->owner = \Auth::user()->id;
     if ($project->save()) {
         if ($request->hasFile('audio')) {
             $file = $request->file('audio');
             $file->move($directory, $file->getClientOriginalName());
             $path = $project->title . '/' . $file->getClientOriginalName();
             if (file_exists($path)) {
                 $layer = new Layer();
                 $layer->label = $request->label;
                 $layer->path = $path;
                 $layer->user_id = \Auth::user()->id;
                 $layer->project_id = $project->id;
                 $layer->save();
             }
         }
     }
     return \Redirect::home();
 }
开发者ID:Alymosul,项目名称:HCI,代码行数:31,代码来源:ProjectsController.php

示例7: store

 public function store(Request $request)
 {
     $user = Auth::user();
     $user_id = $user['id'];
     $directory = "images/" . $user["username"] . "/";
     if ($request->image) {
         $file = $request->image;
         $file->move($directory, $file->getClientOriginalName());
     }
     $project = new Project();
     $project->type = $request->type;
     $project->title = $request->title;
     $project->user_id = $user_id;
     if ($request->image) {
         $project->image = $directory . $file->getClientOriginalName();
     }
     $project->size_width = $request->size_width;
     $project->size_length = $request->size_length;
     $project->measurement = $request->measurement;
     $project->location = $request->location;
     $project->status = $request->status;
     $project->story = $request->story;
     $project->save();
     return redirect()->route('showroom')->with('info', 'Your project has been showcased!');
 }
开发者ID:bambangsusanto,项目名称:planatrium,代码行数:25,代码来源:ShowcaseController.php

示例8: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $project = new Project();
     $project->name = $request->input('name');
     $project->repo_url = $request->input('repo_url');
     $project->init_script = $request->input('init_script');
     $project->base_ami_id = $request->input('base-ami');
     $project->save();
     return redirect()->action('ProjectsController@show', $project->name);
 }
开发者ID:bgnicoll,项目名称:quadraxis,代码行数:16,代码来源:ProjectsController.php

示例9: store

 function store(ProjectRequest $r)
 {
     $project = new Project($r->only('name', 'description'));
     $project->user_id = $r->user()->id;
     $project->save();
     if (!WalletController::generateAddress($project, true)) {
         return redirect()->back()->withErrors("Sorry. The address pool is low, so we were unable to create your project at this time. Try again in an hour");
     }
     return redirect('/projects/' . $project->id);
 }
开发者ID:Someguy123,项目名称:litecoinpledge,代码行数:10,代码来源:ProjectController.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $name = \Input::get('name');
     if (!empty($name)) {
         $project = new Project();
         $project->name = $name;
         $project->save();
         return redirect()->route('project.show', [$project->id]);
     }
 }
开发者ID:sean111,项目名称:phpdeploy,代码行数:16,代码来源:ProjectController.php

示例11: addNewProject

 public function addNewProject($client_id, Request $request)
 {
     $project = new Project();
     $project->client_id = $client_id;
     $project->user_id = Auth::user()->id;
     $project->name = $request->name;
     $project->desc = $request->desc;
     $project->save();
     return $project;
 }
开发者ID:naughton-and-ross,项目名称:clientapp,代码行数:10,代码来源:APIController.php

示例12: saveImage

 private function saveImage(Project $project, ProjectRequest $request)
 {
     if ($request->file('image')) {
         $imageName = $project->id . '.' . $request->file('image')->getClientOriginalExtension();
         $newExt = 'images/catalog/projects' . $imageName;
         $img = Image::make($request->file('image'))->orientate()->heighten(300);
         $img->save(public_path($newExt));
         $project->image_url = $newExt;
         $project->save();
     }
 }
开发者ID:kennethsinder,项目名称:code-in-motion,代码行数:11,代码来源:ProjectsController.php

示例13: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $user = Auth::user();
     $project = new Project();
     $project->name = $request->input('name');
     $project->repository = $request->input('repo');
     $project->repo_provider = $request->input('provider');
     $project->user_id = $user->id;
     $project->save();
     return redirect()->action('ProjectController@index');
 }
开发者ID:Jessewparker,项目名称:jvoyer,代码行数:17,代码来源:ProjectController.php

示例14: store

 public function store(Request $request)
 {
     $rules = array('title' => 'required', 'description' => 'required', 'autor' => 'required', 'cedula' => 'required|integer', 'autor2' => 'required_with:cedula2', 'cedula2' => 'integer|required_with:autor2|unique:projects,cedula2', 'tutor' => 'required_with:cedulatutor', 'cedulatutor' => 'integer|required_with:tutor|unique:projects,cedulatutor');
     $this->validate($request, $rules);
     $project = new Project($request->all());
     $project->estado = "En desarrollo";
     $project->id_user = \Auth::user()->id;
     $project->save();
     $mensaje = "El proyecto fue agregado correctamente";
     \Session::flash('mensaje', $mensaje);
     return redirect()->route('estudiante.index');
 }
开发者ID:JoseOjedaF,项目名称:gproyec3,代码行数:12,代码来源:EstudianteActionController.php

示例15: 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, ['name' => 'required|string', 'department_id' => 'required|numeric']);
     $duplicate = Project::where('name', $request->name)->where('department_id', $request->department_id)->first();
     if ($duplicate) {
         return response()->json(true);
     }
     $project = new Project();
     $project->name = $request->name;
     $project->department_id = $request->department_id;
     $project->save();
 }
开发者ID:mcoyevans,项目名称:personiv-productivity-quality-report,代码行数:18,代码来源:ProjectController.php


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