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


PHP Project::find方法代码示例

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


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

示例1: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create($id)
 {
     //
     $project = Project::find($id);
     $managers = User::where('role', 'Project Manager')->get();
     return view('actions.create', compact('project', 'managers'));
 }
开发者ID:illuminate3,项目名称:PMPortal,代码行数:12,代码来源:ActionsController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(PhotoRequest $request)
 {
     $project_id = $request->input('project_id');
     $featured = Input::file('featured');
     $photos = Input::file('photo');
     $destination = 'images';
     if ($featured->isValid()) {
         $extension = $featured->getClientOriginalExtension();
         $fileName = 'featured-' . $project_id . '.' . $extension;
         $photo = new Photo(['name' => $fileName]);
         Project::find($project_id)->photo()->save($photo);
         $featured->move($destination, $fileName);
     }
     $uploadcount = 1;
     foreach ($photos as $photo) {
         if ($photo->isValid()) {
             $extension = $photo->getClientOriginalExtension();
             $fileName = 'photo' . $uploadcount . '-' . $project_id . '.' . $extension;
             $img = new Photo(['name' => $fileName]);
             Project::find($project_id)->photo()->save($img);
             $photo->move($destination, $fileName);
             $uploadcount++;
         }
     }
     flash()->success('Photos Successfully Uploaded!');
     return redirect('/admin/photos');
 }
开发者ID:botlax,项目名称:talalcontracting,代码行数:33,代码来源:PhotoController.php

示例3: get_single

 public function get_single(Request $request, $id)
 {
     $view = view::make("project");
     $view->projects = Project::all();
     $view->active_project = Project::find($id);
     return $view;
 }
开发者ID:coderehab,项目名称:Tinypmt,代码行数:7,代码来源:ProjectController.php

示例4: directRe

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function directRe($id)
 {
     $proyecto = Project::find($id);
     $boolean = false;
     $projects = Project::all();
     return view('admin.residente.create', compact('proyecto', 'boolean', 'projects'));
 }
开发者ID:JohanArmando,项目名称:ProyectoGrado,代码行数:13,代码来源:ResidenteController.php

示例5: getDelete

 public function getDelete($id)
 {
     $project = \App\Project::find($id);
     $project->delete();
     \Session::flash('flash_message', 'Your project was deleted.');
     return redirect('/projects');
 }
开发者ID:annaphp,项目名称:p4,代码行数:7,代码来源:ProjectsController.php

示例6: add

 public function add(Request $request)
 {
     $me = \Session::get('user');
     if (!$me->can('项目外出记录管理')) {
         abort(401);
     }
     $user = User::find($request->input('user_id'));
     $record = new Record();
     $project = Project::find($request->input('project_id'));
     $record->project()->associate($project);
     $record->user()->associate($user);
     $time = $request->input('time');
     if (!$time) {
         $time = null;
     } else {
         $time = \Carbon\Carbon::createFromFormat('Y/m/d', $time)->format('Y-m-d H:i:s');
     }
     $record->time = $time;
     $record->content = $request->input('content');
     $record->contact = $request->input('contact');
     $record->phone = $request->input('phone');
     $record->software_count = $request->input('software_count');
     $record->hardware_name = $request->input('hardware_name');
     $record->hardware_count = $request->input('hardware_count');
     $record->save();
     \Log::notice(strtr('外出记录添加: 用户(%name[%id]) 添加了项目 %project[%project_id] 的外出记录 %record_id', ['%name' => $me->name, '%id' => $me->id, '%project' => $project->name, '%project_id' => $project->id, '%record_id' => $record->id]));
     return redirect()->back()->with('message_content', '外出记录添加成功!')->with('message_type', 'info')->with('tab', 'records');
 }
开发者ID:genee-projects,项目名称:snail,代码行数:28,代码来源:RecordController.php

示例7: showFeedbacks

 public function showFeedbacks($projectId)
 {
     $project = Project::find($projectId);
     $feedbacks = $project->users()->paginate(10);
     $avgFeedbacks = DB::table('project_user')->where('project_id', $projectId)->avg('mark');
     return view('admin.feedbacks.show', compact('feedbacks', 'avgFeedbacks'));
 }
开发者ID:jtrupina,项目名称:mobile-app-challenge-2015-web,代码行数:7,代码来源:FeedbackController.php

示例8: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $project = Project::find($id);
     $project->update($request->input('form_data'));
     $project->save();
     return $project;
 }
开发者ID:naughton-and-ross,项目名称:clientapp,代码行数:14,代码来源:ProjectController.php

示例9: add

 public function add(Request $request)
 {
     $user = \Session::get('user');
     if (!$user->can('项目硬件部署管理')) {
         abort(401);
     }
     $item = new HardwareItem();
     $project = Project::find($request->input('project_id'));
     $hardware = Hardware::find($request->input('hardware_id'));
     $item->hardware()->associate($hardware);
     $item->project()->associate($project);
     $item->ref_no = $request->input('ref_no');
     $item->status = $request->input('status');
     $item->extra = $request->input('fields', []);
     $time = $request->input('time');
     if (!$time) {
         $time = null;
     } else {
         $time = \Carbon\Carbon::createFromFormat('Y/m/d', $time)->format('Y-m-d H:i:s');
     }
     $item->time = $time;
     $item->save();
     Clog::add($project, '硬件明细添加', [strtr('添加硬件 (%hardware_name) 下新的硬件明细 [%item_id]', ['%hardware_name' => $hardware->name, '%item_id' => $item->id])], Clog::LEVEL_NOTICE);
     \Log::notice(strtr('项目硬件明细增加: 用户(%name[%id]) 添加了项目(%project_name[%project_id]) 硬件 (%hardware_name[%hardware_id]) 的 明细信息: %hardware_item_id', ['%name' => $user->name, '%id' => $user->id, '%project_name' => $project->name, '%project_id' => $project->id, '%hardware_name' => $hardware->name, '%hardware_id' => $hardware->id, '%hardware_item_id' => $item->id]));
     return redirect()->to(route('project.profile', ['id' => $project->id]))->with('message_type', 'info')->with('message_content', '添加部署硬件成功!')->with('tab', 'hardwares');
 }
开发者ID:genee-projects,项目名称:snail,代码行数:26,代码来源:HardwareItemController.php

示例10: upload

 public function upload($project_id, Request $request)
 {
     $user = \Session::get('user');
     if (!$user->can('项目文件管理')) {
         abort(401);
     }
     $project = Project::find($project_id);
     if ($request->hasFile('file')) {
         $path = $request->input('path');
         $file = $request->file('file')->getClientOriginalName();
         $full_path = \App\NFS::full_path($project, $path);
         $full_file = \App\NFS::full_path($project, $path . '/' . $file);
         if (file_exists($full_file)) {
             $dirname = dirname($full_file) . '/';
             $info = \App\NFS::pathinfo($full_file);
             $extension = $info['extension'] ? '.' . $info['extension'] : '';
             $name = substr($file, 0, strrpos($file, '.') ?: strlen($file));
             $suffix_count = 2;
             do {
                 $file_name = $name . '(' . $suffix_count . ')' . $extension;
                 $full_file = $dirname . $file_name;
                 ++$suffix_count;
             } while (file_exists($full_file));
         }
         $file = substr($full_file, strrpos($full_file, '/') + 1);
         \Log::notice(strtr('文件上传: 用户(%name[%id]) 在路径 %path 中上传了文件 %file', ['%name' => $user->name, '%id' => $user->id, '%path' => $full_path, '%file' => $file]));
         $request->file('file')->move($full_path, $file);
         return redirect()->back()->with('message_content', '上传成功!')->with('message_type', 'info');
     } else {
         return redirect()->back()->with('message_content', '上传失败')->with('message_type', 'danger');
     }
 }
开发者ID:genee-projects,项目名称:snail,代码行数:32,代码来源:NFSController.php

示例11: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $project = Project::findOrFail($id);
     $tasks = Project::find($id)->tasks()->get();
     $data = array('project' => $project, 'tasks' => $tasks);
     return view('project.show', $data);
 }
开发者ID:vudn-job,项目名称:todo-list,代码行数:13,代码来源:ProjectController.php

示例12: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //
     $chart = Chart::where('project_id', $id)->first();
     $project = Project::find($id);
     return view('charts.edit', compact('chart', 'project'));
 }
开发者ID:illuminate3,项目名称:PMPortal,代码行数:13,代码来源:ChartsController.php

示例13: removeMember

 public function removeMember(Request $request, $id)
 {
     $project = Project::find($id);
     $users = $request->input('users', []);
     $removeMembers = $project->users()->whereIn('id', $users)->get();
     $project->users()->detach($users);
     return $removeMembers;
 }
开发者ID:shana0440,项目名称:project-management-system,代码行数:8,代码来源:ProjectController.php

示例14: __construct

 /**
  * Create a new job instance.
  * @param  Project  $project
  * @return void
  */
 public function __construct($sample_cleaned_content, $data, $project_id, $last = null)
 {
     // $this->project_id = $project_id;
     $this->project = Project::find($project_id);
     $this->sample_cleaned_content = $sample_cleaned_content;
     $this->data = $data;
     $this->last = $last;
 }
开发者ID:hvs-fasya,项目名称:seo_padawan,代码行数:13,代码来源:HandleDataJob.php

示例15: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //
     $deliverables = Deliverable::where('project_id', $id)->get();
     $managers = User::where('role', 'Project Manager')->get();
     $project = Project::find($id);
     return view('deliverables.edit', compact('deliverables', 'project', 'managers'));
 }
开发者ID:illuminate3,项目名称:PMPortal,代码行数:14,代码来源:DeliverablesController.php


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