本文整理汇总了PHP中Project::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::find方法的具体用法?PHP Project::find怎么用?PHP Project::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_template_toggle_recommended
public function action_template_toggle_recommended($project_id)
{
$project = Project::find($project_id);
$project->recommended = $project->recommended == 1 ? 0 : 1;
$project->save();
return Redirect::back();
}
示例2: all
/** List all projects, this is the default Route. */
public function all()
{
$this->projects = Project::find('all', array('order by' => 'created_at desc'));
if ($this->projects->count() == 0) {
$this->projects = array();
}
}
示例3: bid
public static function bid($attributes = array(), $project_id = false)
{
$faker = Faker\Factory::create();
$p = $project_id ? Project::find($project_id) : Project::where_not_null('posted_to_fbo_at')->order_by(\DB::raw('RAND()'))->first();
$v = Vendor::order_by(\DB::raw('RAND()'))->first();
$prices = array();
foreach (array_keys($p->deliverables) as $d) {
$prices[$d] = rand(100, 10000);
}
$b = new Bid(array('project_id' => $p->id, 'approach' => $faker->paragraph, 'previous_work' => $faker->paragraph, 'employee_details' => "Adam Becker\n" . "Craig Collyer", 'prices' => $prices));
$b->starred = rand(0, 1);
$b->vendor_id = $v->id;
$b->save();
if (rand(0, 6) === 0) {
$b->delete_by_vendor();
} else {
if (rand(0, 1) === 0) {
$submitted_at = new \DateTime();
$b->submitted_at = rand(0, 1) === 0 ? $submitted_at : null;
$b->submit();
// Dismiss 1/3 of the bids
if (rand(0, 2) === 0) {
$b->dismiss(Bid::$dismissal_reasons[array_rand(Bid::$default_dismissal_reasons)], $faker->paragraph(2));
// Un-dismiss 1/2 of these
if (rand(0, 1) === 0) {
$b->undismiss();
}
}
}
}
}
示例4: save
public function save()
{
// Get all inputs
$input = Input::all();
// Retrive the project details
$project = Project::find($input['project_id']);
// Assign values
$project->name = $input['name'];
$project->project_type = $input['project_type'];
$project->description = $input['description'];
$project->client_name = $input['client_name'];
$project->start_at = $input['start_at'];
$project->complete_at = $input['complete_at'];
// Identify if this project is on hold or not
if (isset($input['status'])) {
$project->status = 2;
} else {
$project->status = 1;
}
// Update the project details
$project->save();
// Assign each user in a project
foreach (array_merge($input['developers'], $input['qc']) as $key => $value) {
$user = ProjectUsers::firstOrCreate(array('project_id' => $input['project_id'], 'user_id' => $value));
$user->key = Crypt::encrypt(time());
$user->save();
}
// Redirect to project page with message
return Redirect::to('/project/' . $project->slug)->with('flash_msg', 'This project was successfully updated!');
}
示例5: completeProject
public function completeProject()
{
$id = $_GET['id'];
$Project = Project::find($id);
$Project->complete();
return Redirect::back();
}
示例6: dopublish
public function dopublish()
{
$id = intval(Input::get('id'));
$this->check_own($id);
$project = Project::find($id);
if (!$id || !$project) {
return Response::json(array("result" => false, 'msg' => '项目不存在'));
}
$version = trim(Input::get('project_select_version'));
if (!preg_match('/^\\w+$/i', $version)) {
return Response::json(array("result" => false, 'msg' => '请选择正确的版本'));
}
$task_ids = array('upd_prj' => '', 'sync_svr' => array());
$task_ids['upd_prj'] = Task::create('update', Auth::id(), array('project_id' => $id, "version" => $version));
$servers_id = Input::get('publish_box');
$servers = Server::whereIn("id", $servers_id)->get();
foreach ($servers as $key => $value) {
if ($value->project_id != $id) {
//检查服务器是不是属于project
continue;
}
$task_ids['sync_svr'][$value->id] = Task::create('rsync', Auth::id(), array('server_id' => $value->id), $task_ids['upd_prj']);
}
return Response::json(array("result" => true, 'msg' => '', 'tasks' => $task_ids));
}
示例7: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$user = Auth::user();
$project = Project::find($request->input('id'));
if ($project->user_id != $user->id) {
return redirect('/');
}
return $next($request);
}
示例8: show
/**
* @desc: Shows a project
*/
public function show()
{
try {
$this->template->assign('project', Project::find($this->request->getParameter('id')));
} catch (ActiveRecordException $rnfEx) {
$this->flash('error', $rnfEx->getMessage());
$this->redirect_to('index');
}
}
示例9: index
public function index($projectId)
{
$images = Project::find($projectId)->images;
if (count($images)) {
return Response::json($images);
} else {
return Response::json(['alert' => 'Images' . Messages::$notFound], 404);
}
}
示例10: activity
public function activity($activity_limit = 5)
{
$users = $comments = $activity_type = array();
$issue = $this;
$project_id = $this->project_id;
$project = \Project::find($project_id);
foreach (\Activity::all() as $row) {
$activity_type[$row->id] = $row;
}
$activities = array();
foreach (\User\Activity::where('item_id', '=', $issue->id)->order_by('created_at', 'ASC')->get() as $activity) {
$activities[] = $activity;
switch ($activity->type_id) {
case 2:
if (!isset($users[$activity->user_id])) {
$users[$activity->user_id] = \User::find($activity->user_id);
}
if (!isset($comments[$activity->action_id])) {
$comments[$activity->action_id] = \Project\Issue\Comment::find($activity->action_id);
}
break;
case 5:
if (!isset($users[$activity->user_id])) {
$users[$activity->user_id] = \User::find($activity->user_id);
}
if (!isset($users[$activity->action_id])) {
$users[$activity->action_id] = \User::find($activity->action_id);
}
break;
default:
if (!isset($users[$activity->user_id])) {
$users[$activity->user_id] = \User::find($activity->user_id);
}
break;
}
}
/* Loop through the projects and activity again, building the views for each activity */
$return = array();
foreach ($activities as $row) {
switch ($row->type_id) {
case 2:
$return[] = \View::make('project/issue/activity/' . $activity_type[$row->type_id]->activity, array('issue' => $issue, 'project' => $project, 'user' => $users[$row->user_id], 'comment' => $comments[$row->action_id], 'activity' => $row));
break;
case 3:
$return[] = \View::make('project/issue/activity/' . $activity_type[$row->type_id]->activity, array('issue' => $issue, 'project' => $project, 'user' => $users[$row->user_id], 'activity' => $row));
break;
case 5:
$return[] = \View::make('project/issue/activity/' . $activity_type[$row->type_id]->activity, array('issue' => $issue, 'project' => $project, 'user' => $users[$row->user_id], 'assigned' => $users[$row->action_id], 'activity' => $row));
break;
default:
$return[] = \View::make('project/issue/activity/' . $activity_type[$row->type_id]->activity, array('issue' => $issue, 'project' => $project, 'user' => $users[$row->user_id], 'activity' => $row));
break;
}
}
return $return;
}
示例11: updateProject
public function updateProject()
{
$id = Input::get('id');
$fieldname = Input::get('field');
$value = Input::get('value');
$project = Project::find($id);
$project->{$fieldname} = $value;
$project->save();
return $this->success(null, null);
}
示例12: destroy
public function destroy($id)
{
//project
$project = Project::find($id);
if (sizeof($project->iterations) < 1) {
$project->delete();
}
$organization = app('organization');
return Redirect::to('organization/name/' . $organization->auxName . '/projects')->with('message', 'Registro eliminado');
}
示例13: upload
public function upload()
{
if (Auth::user() !== null) {
$project = Project::find(Auth::user()->project_id);
//$project = Project::find($id);
return View::make('uploads.uploads', compact('project'));
} else {
return Redirect::to('index');
}
}
示例14: show
public function show()
{
if (Auth::user() !== null) {
$project = Project::find(Auth::user()->project_id);
$id = $project->id;
$construction = DB::table('constructions')->where('project_id', $id)->first();
return View::make('portal.construction', compact('construction', 'id'));
} else {
return Redirect::to('index');
}
}
示例15: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show()
{
//
if (Auth::user() !== null) {
$project = Project::find(Auth::user()->project_id);
$id = $project->id;
return View::make('portal.sideBar.property', compact('id'));
} else {
return Redirect::to('index');
}
}