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


PHP Project::client方法代码示例

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


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

示例1: store

 /**
  * Save a new project to the database
  *
  * @param ProjectRequest $request The incoming request.
  *
  * @return void
  */
 public function store(ProjectRequest $request)
 {
     $project = new Project();
     $clientId = $request->input('client_id', 0);
     $client = $request->user()->clients()->findOrFail($clientId);
     $project->name = $request->input('name');
     $project->active = $request->input('active', 0);
     $project->billable = $request->input('billable', 0);
     $project->taxDeducted = $request->input('taxDeducted', 0);
     $project->user()->associate($request->user());
     $project->client()->associate($client);
     $project->save();
 }
开发者ID:lovett,项目名称:toils,代码行数:20,代码来源:ProjectController.php

示例2: add

 public function add(Request $request)
 {
     $user = \Session::get('user');
     if (!$user->can('项目签约')) {
         abort(401);
     }
     $sub = SubProduct::find($request->input('product_id'));
     $client = Client::find($request->input('client_id'));
     $project = new Project();
     $project->product()->associate($sub);
     $project->client()->associate($client);
     $project->vip = (bool) ($request->input('vip') == 'on');
     $project->signed_status = $request->input('signed_status');
     $project->ref_no = $request->input('ref_no');
     $project->name = $request->input('name');
     $project->seller = $request->input('seller');
     $project->contact_user = $request->input('contact_user');
     $signed_time = $request->input('signed_time');
     if (!$signed_time) {
         $signed_time = null;
     } else {
         $signed_time = \Carbon\Carbon::createFromFormat('Y/m/d', $signed_time)->format('Y-m-d H:i:s');
     }
     $project->signed_time = $signed_time;
     // 签约时间
     $service_unit = $request->input('service_unit');
     $service_value = $request->input('service_value');
     # 维保时间
     $project->service_unit = $service_unit;
     $project->service_value = $service_value;
     $project->description = $request->input('description');
     if ($project->save()) {
         foreach ($sub->modules as $module) {
             $project->modules()->save($module);
         }
         foreach ($sub->params as $param) {
             $project->params()->save($param, ['value' => $param->pivot->value]);
         }
         Clog::add($project, '签约项目');
         Clog::add($project->client, '签约项目', [$project->name], Clog::LEVEL_WARNING);
         \Log::notice(strtr('客户项目签约: 用户(%name[%id]) 签约了项目: (%project_name[%project_id]), 客户: (%client_name[%client_id], 子产品: (%product_name[%product_id])', ['%name' => $user->name, '%id' => $user->id, '%project_name' => $project->name, '%project_id' => $project->id, '%client_name' => $client->name, '%client_id' => $client->id, '%product_name' => $sub->name, '%product_id' => $sub->id]));
         return redirect(route('project.profile', ['id' => $project->id]))->with('message_content', '签约成功!')->with('message_type', 'info');
     }
 }
开发者ID:genee-projects,项目名称:snail,代码行数:44,代码来源:ProjectController.php


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