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


PHP Project::create方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Request::all();
     $input['user_id'] = Auth::User()->id;
     $validation = Project::validate($input);
     if ($validation->fails()) {
         $message = $validation->messages()->first();
         return Response()->json(ResponseManager::getError('', 10, $message));
     }
     $project = Project::create($input);
     if ($project) {
         //            if (array_key_exists('users', $input)) {
         //                foreach ($input['users'] as $user) {
         //                    $data = ['project_id' => $project['id'], 'user_id' => $user['id'], 'email' => $user['email']];
         //                    ProjectUser::create($data);
         //                    $email['email'] = $user['email'];
         //                    $email['user'] = $user['name'];
         //                    $email['msg'] = $input['message'];
         //                    $email['pname'] = $project['name'];
         //                    $email['code'] = base64_encode($email['email'] . '-' . $project['id']);
         //                    Mail::send('emails.invite', $email, function( $message ) use ($email) {
         //                        $message->to($email['email'])->subject(Auth::User()->name . ' want to add you to ' . $email['pname']);
         //                    });
         //                }
         //            }
         $message = 'Added Successfully.';
         return Response()->json(ResponseManager::getResult($project, 10, $message));
     } else {
         $message = 'Something went wrong. Please try again.';
         return Response()->json(ResponseManager::getError('', 10, $message));
     }
 }
开发者ID:maineventio,项目名称:newprojectbase,代码行数:37,代码来源:ProjectController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  * POST /projects
  *
  * @return Response
  */
 public function store($society, ProjectsRequest $request)
 {
     $project = Project::create($request->all());
     $project->society_id = $society;
     $project->save();
     return Redirect::route('society.projects.edit', array($society, $project->id))->with('okmessage', 'New project has been added');
 }
开发者ID:bishopm,项目名称:circuit,代码行数:13,代码来源:ProjectsController.php

示例3: 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, $this->rules);
     $input = $this->filter_project_input();
     $project = Project::create($input);
     return Redirect::route('projects.show', $project->slug)->with('flash_success', 'Projeto criado ');
 }
开发者ID:novaskideveloper,项目名称:PeaceLabs,代码行数:13,代码来源:ProjectsController.php

示例4: run

 public function run()
 {
     DB::table('projects')->delete();
     $collection = [['project_types_id' => 1, 'project_statuses_id' => 4, 'disassemblers_id' => 1, 'creator_id' => 2, 'company_id' => 5, 'directory_path' => 'starfleet_academy/2015/37833_N195UA/', 'sales_id' => 7, 'project_start_date' => '2015-12-07', 'asset_arrival_date' => '2015-12-25', 'projected_completion_date' => '2016-01-10'], ['project_types_id' => 1, 'project_statuses_id' => 4, 'disassemblers_id' => 1, 'creator_id' => 2, 'directory_path' => 'starfleet_academy/2015/', 'company_id' => 5, 'sales_id' => 7, 'project_start_date' => '2015-12-07', 'asset_arrival_date' => '2015-12-25', 'projected_completion_date' => '2016-01-10'], ['project_types_id' => 1, 'project_statuses_id' => 3, 'disassemblers_id' => 1, 'creator_id' => 2, 'directory_path' => 'starfleet_academy/2015/', 'company_id' => 5, 'sales_id' => 7, 'project_start_date' => '2015-12-07', 'asset_arrival_date' => '2015-12-25', 'projected_completion_date' => '2016-01-10'], ['project_types_id' => 1, 'project_statuses_id' => 2, 'disassemblers_id' => 1, 'creator_id' => 2, 'directory_path' => 'starfleet_academy/2015/', 'company_id' => 5, 'sales_id' => 7, 'project_start_date' => '2015-12-07', 'asset_arrival_date' => '2015-12-25', 'projected_completion_date' => '2016-01-10'], ['project_types_id' => 1, 'project_statuses_id' => 1, 'disassemblers_id' => 1, 'creator_id' => 2, 'directory_path' => 'starfleet_academy/2015/', 'company_id' => 5, 'sales_id' => 7, 'project_start_date' => '2015-12-07', 'asset_arrival_date' => '2015-12-25', 'projected_completion_date' => '2016-01-10']];
     foreach ($collection as $record) {
         Project::create($record);
     }
 }
开发者ID:wyrover,项目名称:aeroeco,代码行数:8,代码来源:ProjectsTableSeeder.php

示例5: createProject

 protected function createProject()
 {
     $bSuccess = Project::create(['projectName' => $this->request->name, 'description' => $this->request->desc, 'userId' => Auth::user()->id, 'status' => 'open']);
     if ($bSuccess) {
         $oProject = ['oProject' => Project::getProject(), 'message' => 'Project successfully created.'];
         return response()->json($oProject);
     }
 }
开发者ID:xrexonx,项目名称:LaravelCRUD,代码行数:8,代码来源:ProjectController.php

示例6: create

 protected function create($values)
 {
     $data = [];
     foreach ($this->structure as $i => $key) {
         $data[$key] = $values[$i];
     }
     Project::create($data);
 }
开发者ID:herzcthu,项目名称:Laravel-HS,代码行数:8,代码来源:ProjectsSeeder.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $img = $request->input('project');
     $img = str_replace('data:image/png;base64,', '', $img);
     $img = str_replace(' ', '+', $img);
     $img = base64_decode($img);
     $url = 'assets/projects/projects' . time() . '.png';
     file_put_contents($url, $img);
     $project = Project::create(['url' => $url, 'user_id' => \Auth::user()->id]);
 }
开发者ID:shanth2600,项目名称:project2,代码行数:16,代码来源:ProjectController.php

示例8: update

 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Project::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }
开发者ID:RHT-Memphis,项目名称:aeroeco,代码行数:11,代码来源:ProjectsController.php

示例9: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->middleware('auth');
     if ($user = auth()->user()) {
         $this->validate($request, $this->rules);
         $input = $this->filter_project_input();
         $input['slug'] = $this->makeSlugFromTitle($input['name']);
         $project = Project::create($input);
         $project->members()->attach($user->id, ['role' => 'owner']);
         return Redirect::route('projects.show', $project->slug)->with('flash_success', 'Projeto criado.');
     } else {
         return Redirect::route('home')->with('flash_danger', 'Operação não permitida.');
     }
 }
开发者ID:CodeForBrazil,项目名称:PeaceLabs,代码行数:20,代码来源:ProjectsController.php

示例10: add

 public function add()
 {
     $data = Input::all();
     unset($data['_token']);
     $rules = array('name' => 'required|min:5|max:30', 'key' => 'required|min:16|max:255', 'ip' => 'required|min:7|max:255', 'manage' => 'required|min:5|max:30|exists:users,username', 'description' => 'sometimes|max:255', 'star_switch' => 'required|Integer', 'edit_switch' => 'required|Integer', 'quote_switch' => 'required|Integer', 'level_top_num' => 'required_if:quote_switch,1|Integer', 'level_bot_num' => 'required_if:quote_switch,1|Integer', 'page_num' => 'required|Integer', 'status' => 'required|Integer');
     $valid = Validator::make($data, $rules);
     if ($valid->fails()) {
         return Redirect::to('msg')->withInput()->with('jump_sec', 3)->withErrors($valid);
     } else {
         $p = new Project();
         $ok = $p->create($data);
         return Redirect::to('msg')->withInput()->with('jump_sec', 3)->with('jump_url', URL::to('admin/project_list'))->with('message', "id: {$ok->id}  name: {$ok->name} 添加成功!");
     }
 }
开发者ID:snyh,项目名称:just-calc-dstore-info,代码行数:14,代码来源:ProjectController.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['name' => 'required', 'status' => 'required|in:draft,accepted,pending,refused,command,billing', 'quotation_price' => 'integer', 'quotation_date' => 'date', 'customer_id' => 'required|integer']);
     if ($validator->fails()) {
         return response()->json($validator->errors()->all(), 400);
     }
     try {
         $customer = Customer::findOrFail($request->input('customer_id'));
     } catch (Exception $e) {
         return response()->json('Le client n\'existe pas.', 404);
     }
     $project = Project::create(['name' => $request->get('name'), 'status' => $request->get('status'), 'quotation_price' => $request->get('quotation_price'), 'quotation_date' => $request->get('quotation_date'), 'customer_id' => $request->get('customer_id'), 'user_id' => Auth::user()->id]);
     return $project;
 }
开发者ID:oarGroupeCesi,项目名称:madera_api,代码行数:20,代码来源:ProjectController.php

示例12: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     //测试运行逻辑是否成功
     /*$data = $request->all();
       return $data;*/
     //判断是否登陆
     if (Auth::guest()) {
         return redirect('/auth/login');
     }
     $default = array('status' => '1', 'img_url' => '/image/project_img/project_item.jpg');
     $date = $request->all() + $default;
     //dd($date);//测试数据正确性
     Project::create($date);
     return redirect('/feature/project');
     //
 }
开发者ID:saviorZSC,项目名称:zsc_laravel,代码行数:21,代码来源:FeatureController.php

示例13: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(ProjectRequest $request)
 {
     $input = $request->except($this->image);
     $input['start_date'] = Carbon\Carbon::parse($request->get('start_date'))->format('Y-m-d');
     $input['end_date'] = Carbon\Carbon::parse($request->get('end_date'))->format('Y-m-d');
     $input[$this->image] = Project::upload_projectfile($request, $this->image);
     $input['added_by'] = Auth::user()->id;
     $project = Project::create($input);
     $timeline['object_type'] = 1;
     $timeline['object_id'] = $project->id;
     $timeline['action'] = 'create';
     $timeline['description'] = '<a href="javascript:;">' . $input['name'] . '</a> project has been created by ' . Auth::user()->first_name . ' ' . Auth::user()->last_name . '.';
     Timeline::create($timeline);
     Session::flash($this->success, Lang::get('ruban.project.created'));
     return Redirect::route('ruban.projects.index');
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:21,代码来源:ProjectController.php

示例14: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Project::truncate();
     Timer::truncate();
     $faker = Faker::create();
     $john = User::where('name', 'John')->first();
     $payee_john = Payee::find($john->id);
     $payer_john = Payer::find($john->id);
     $jenny = User::where('name', 'Jenny')->first();
     $jane = User::where('name', 'Jane')->first();
     $bob = User::where('name', 'Bob')->first();
     $payee_bob = Payee::find($bob->id);
     /**
      * John is payee
      */
     //        dd($faker->randomElement([1,2,3]));
     //        dd($faker->randomElement($payee_john->payers()->lists('id')));
     //        dd($payee_john->payers()->lists('id')->all());
     foreach (range(0, 2) as $index) {
         $project = Project::create(['payee_id' => $john->id, 'payer_id' => $faker->randomElement($payee_john->payers()->lists('id')->all()), 'description' => $faker->word, 'rate_per_hour' => 40, 'status' => 'confirmed']);
         $this->createTimersForProject($project);
     }
     //Create a project with Jenny as payer
     $project = Project::create(['payee_id' => $john->id, 'payer_id' => $jenny->id, 'description' => $faker->word, 'rate_per_hour' => 40, 'status' => 'confirmed']);
     $this->createTimersForProject($project);
     /**
      * John is payer
      */
     foreach (range(0, 2) as $index) {
         $project = Project::create(['payee_id' => $faker->randomElement($payer_john->payees()->lists('id')->all()), 'payer_id' => $john->id, 'description' => $faker->word, 'rate_per_hour' => 1, 'status' => 'confirmed']);
         $this->createTimersForProject($project);
     }
     /**
      * Bob is payee
      */
     foreach (range(0, 4) as $index) {
         $project = Project::create(['payee_id' => $bob->id, 'payer_id' => $jenny->id, 'description' => $faker->word, 'rate_per_hour' => 40, 'status' => 'confirmed']);
         $this->createTimersForProject($project);
     }
     /**
      * Jenny is payee
      */
     foreach (range(0, 2) as $index) {
         $project = Project::create(['payee_id' => $jenny->id, 'payer_id' => $john->id, 'description' => $faker->word, 'rate_per_hour' => 10, 'status' => 'confirmed']);
         $this->createTimersForProject($project);
     }
 }
开发者ID:JennySwift,项目名称:project-tracker,代码行数:52,代码来源:ProjectSeeder.php

示例15: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(ProjectsRequest $request)
 {
     $project = Project::create($request->except('tags'));
     $project->tags = implode(',', $request->input('tags'));
     $project->user_id = Auth::user()->id;
     if ($request->file('photo')) {
         $fileName = $project->id . "." . $request->file('photo')->getClientOriginalExtension();
         $request->file('photo')->move(base_path() . '/storage/app/images/', $fileName);
         $project->photo = '/storage/app/images/' . $fileName;
         $img = Image::make(base_path() . $project->photo);
         $img->resize(250, null, function ($constraint) {
             $constraint->aspectRatio();
         });
         $img->save(base_path() . '/storage/app/images/' . $fileName);
     }
     $project->save();
     return redirect()->route('projects.index');
 }
开发者ID:bishopm,项目名称:ncc,代码行数:24,代码来源:ProjectsController.php


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