本文整理汇总了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'));
}
示例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');
}
示例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;
}
示例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'));
}
示例5: getDelete
public function getDelete($id)
{
$project = \App\Project::find($id);
$project->delete();
\Session::flash('flash_message', 'Your project was deleted.');
return redirect('/projects');
}
示例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');
}
示例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'));
}
示例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;
}
示例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');
}
示例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');
}
}
示例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);
}
示例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'));
}
示例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;
}
示例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;
}
示例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'));
}