本文整理汇总了PHP中app\Project类的典型用法代码示例。如果您正苦于以下问题:PHP Project类的具体用法?PHP Project怎么用?PHP Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Project类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
public function destroy(Project $project)
{
if (!$project->hasOne(Todo::class)->exists()) {
$project->delete();
}
return redirect('/projects');
}
示例2: 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!');
}
示例3: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(ProjectUpdateRequest $request, $id)
{
$project = new Project($request->all());
Project::where('id', $id)->update($project->getAttributes());
flash()->success(trans('project.label.name'), trans('project.message_alert.update_success'));
return redirect('/projects');
}
示例4: update
public function update(Project $project, ProjectRequest $request)
{
//Client $client refrences a Route Model Binding method found is RouteServiceProvider.php
$project->update($request->all());
\Session::flash('flash_message', 'Project ' . $project->project_name . ' was updated.');
return redirect('projects');
}
示例5: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update(Project $project, User $user, Request $request)
{
$this->validate($request, ['type' => 'in:owner,developer,client', 'user_id' => 'exists:users_projects']);
$data = ['type' => $request->get('type')];
$project->users()->updateExistingPivot($user->id, $data);
return response()->json(['success' => true, 'message' => 'Project Member updated.']);
}
示例6: boot
/**
* Define your route model bindings, pattern filters, etc.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function boot(Router $router)
{
$router->bind('article', function ($value) {
return $this->getArticle()->where('slug', $value)->firstOrFail();
});
$router->bind('cong-ty', function ($value) {
return \App\Company::where('slug', $value)->firstOrFail();
});
$router->bind('thiet-ke-thi-cong', function ($value) {
return $this->designModel->getDesigns()->where('designs.slug', $value)->firstOrFail();
});
$router->bind('house', function ($value) {
return $this->houseModel->getHouses()->where('houses.slug', $value)->firstOrFail();
});
$router->bind('company', function ($value) {
return \App\Company::where('slug', $value)->firstOrFail();
});
$router->bind('project', function ($value) {
return $this->projectModel->getProjects()->where('projects.slug', $value)->firstOrFail();
});
$router->model('owner', 'App\\House');
$router->model('agency', 'App\\House');
$router->model('message', 'App\\Message');
parent::boot($router);
}
示例7: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Project $project, Request $request)
{
$user = JWTAuth::parseToken()->authenticate();
$backlog = Backlog::create($request->only('name'));
$project->backlogs()->save($backlog);
$user->backlogs()->save($backlog);
return response()->json(['status' => 'success', 'backlog' => $backlog]);
}
示例8: show
/**
* @param Project $project
* @return \Illuminate\View\View
*/
public function show(Project $project)
{
$projectsRelation = $this->projectModel->getProjects()->limit(6)->get();
$contactInfo = User::join('profiles', 'users.id', '=', 'profiles.user_id')->where('user_id', $project->user_id)->first();
$preview = Project::isApproved(1)->where('id', '<', $project->id)->orderBy('id', 'desc')->first();
$next = Project::isApproved(1)->where('id', '>', $project->id)->orderBy('id', 'asc')->first();
return view('front.projects.show', compact('project', 'projectsRelation', 'contactInfo', 'preview', 'next'));
}
示例9: store
public function store(Project $project, Request $request)
{
$user = JWTAuth::parseToken()->authenticate();
$story = Story::create($request->only('name'));
$project->stories()->save($story);
$user->stories()->save($story);
return response()->json(['status' => 'success', 'story' => $story, 'message' => 'Story created.']);
}
示例10: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Project $project, Request $request)
{
$user = JWTAuth::parseToken()->authenticate();
$sprint = App::make('App\\Sprint')->create($request->only('name', 'release'));
// $sprint = Sprint::create($request->only('name','release'));
$project->sprints()->save($sprint);
// $user->sprints()->save($sprint);
return response()->json(['status' => 'success']);
}
示例11: 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);
}
示例12: composeSidebar
/**
* Hiển thị 10 bài viết mới nhất ở sidebar (layout)
*
* @return void
*/
public function composeSidebar()
{
view()->composer('_sidebar', function ($view) {
// recommend
$view->with('houseSaleRecommend', $this->houseModel->getHouses()->saleType(SaleTypeOptions::BAN)->first());
$view->with('houseRentRecommend', $this->houseModel->getHouses()->saleType(SaleTypeOptions::CHO_THUE)->first());
$view->with('houseProjectRecommend', $this->projectModel->getProjects()->first());
$view->with('designRecommend', $this->designModel->getDesigns()->first());
});
}
示例13: 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;
}
示例14: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Project $project, Backlog $backlog, Request $request)
{
$user = JWTAuth::parseToken()->authenticate();
// $sprint = App::make('App\Sprint')->create($request->only('name','release'));
$sprint = Sprint::create($request->only('name'));
$project->sprints()->save($sprint);
$user->sprints()->save($sprint);
event(new FeedableEvent('SprintCreated', $user, $sprint, $project));
return response()->json(['status' => 'success', 'Sprint' => $sprint, 'Message' => 'Sprint created.']);
}
示例15: store
/**
* Store a newly created task.
*
* @param Request $request
* @param Project $project
* @return Task
*/
public function store(Request $request, Project $project)
{
$task = new Task($request->all());
if (!empty($user_id = $request->input('user_id'))) {
$user = \App\User::findOrFail($user_id);
$task->assignee()->associate($user);
}
$project->tasks()->save($task);
return $task;
}