本文整理汇总了PHP中Project::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::findOrFail方法的具体用法?PHP Project::findOrFail怎么用?PHP Project::findOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::findOrFail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update($id)
{
$project = Project::findOrFail($id);
$project->fill(Input::all());
$project->save();
$organization = app('organization');
return Redirect::to('organization/name/' . $organization->auxName . '/projects')->with('message', 'Registro actualizado');
}
示例2: update
/**
* Update the specified resource in storage.
* PUT /projects/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
$project = Project::findOrFail($id);
$validator = Validator::make($data = Input::all(), Project::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$data['changed_by'] = Auth::user()->id;
$project->update($data);
return Redirect::route('admin.projects.index');
}
示例3: checkFinishedProject
public static function checkFinishedProject($id)
{
$current_date = date("Y-m-d");
$project = Project::findOrFail($id);
$end_date = $project->endDate;
if ($current_date > $end_date) {
//if($current_date > '2016-05-31'){
//if('2017-05-31' > '2016-05-31'){
return 'MAYOR';
} else {
return 'MENOR';
}
}
示例4: summary
/**
*
*/
public function summary($id)
{
$iterationAux;
//try {
$project = Project::findOrFail($id);
$iterations = Iterations::where('projectid', '=', $id)->get();
//foreach($iterations as $var){
// $iterationAux = $iterationAux . var_dump($var);
//}
//}catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
//}
//die;
JpGraph\JpGraph::load();
JpGraph\JpGraph::module('bar');
JpGraph\JpGraph::module('line');
$datay = array(20, 30, 50, 80);
$datay2 = array(30, 95, 70, 40);
$datazero = array(0, 0, 0, 0);
// Create the graph.
$graph = new Graph(800, 500);
$graph->title->Set('Example with 2 scale bars : ' . $project->name . ' : ' . $id . ' : ' . sizeof($iterations));
// Setup Y and Y2 scales with some "grace"
$graph->SetScale("textlin");
$graph->SetY2Scale("lin");
//$graph->yaxis->scale->SetGrace(30);
//$graph->y2axis->scale->SetGrace(30);
//$graph->ygrid->Show(true,true);
$graph->ygrid->SetColor('gray', 'lightgray@0.5');
// Setup graph colors
$graph->SetMarginColor('white');
$graph->y2axis->SetColor('darkred');
// Create the "dummy" 0 bplot
$bplotzero = new BarPlot($datazero);
// Create the "Y" axis group
$ybplot1 = new BarPlot($datay);
$ybplot1->value->Show();
$ybplot = new GroupBarPlot(array($ybplot1, $bplotzero));
// Create the "Y2" axis group
$ybplot2 = new BarPlot($datay2);
$ybplot2->value->Show();
$ybplot2->value->SetColor('darkred');
$ybplot2->SetFillColor('darkred');
$y2bplot = new GroupBarPlot(array($bplotzero, $ybplot2));
// Add the grouped bar plots to the graph
$graph->Add($ybplot);
$graph->AddY2($y2bplot);
$datax = array('A', 'B', 'C', 'D');
$graph->xaxis->SetTickLabels($datax);
// .. and finally stroke the image back to browser
$graph->Stroke();
}
示例5: projects
public function projects()
{
$teams = $this->belongsToMany('Teams', 'memberof', 'usersid', 'teamid')->get();
$projects = array();
foreach ($teams as $var) {
$projects[] = Project::findOrFail($var->id);
//$project = Project::findOrFail($var->id)->get();
//print_r($project->name);
//print_r($var->id);
//die();
}
//print_r(count($projects));
//return count($teams);
return $projects;
}
示例6: function
$aditionalCost->description = Input::get("description");
$aditionalCost->total = Input::get("total");
$aditionalCost->taskid = Input::get("taskid");
$aditionalCost->save();
}
return Response::json(array('succes' => '', 'aditionalCost' => $aditionalCost));
}
});
/**
* grabar un gasto adicional de la tarea
**/
Route::get('aditionalCost/delete', function () {
if (Request::ajax()) {
$id = Input::get("id");
if (!empty(Input::get("id"))) {
$additionalCost = AdditionalCost::find($id);
$additionalCost->delete();
}
return Response::json(array('succes' => '1'));
}
});
/**
*
*/
Route::get('ajax/getProject', function () {
if (Request::ajax()) {
$id = Input::get("id");
$project = Project::findOrFail($id);
return Response::json(array('project' => $project, 'iterations' => $project->iterations));
}
});
示例7: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
Project::findOrFail($id)->delete();
Flash::message('Project Deleted!');
return Redirect::route('projects')->with('Flash_message', 'Project Deleted');
}
示例8: edit
public function edit($id)
{
try {
$project = Project::findOrFail($id);
} catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
$organization = app('organization');
return Redirect::to('/organization/name/' . $organization->auxName . '/projects')->with('error', 'No existe el proyecto');
}
$this->layout->content = View::make('layouts.projects.new')->with('project', $project)->with('type', 'edit');
}
示例9: find
/**
* @param $id
*
* @return mixed
*/
public function find($id)
{
return $this->project->findOrFail($id);
}
示例10: getProject
public static function getProject($projectID)
{
try {
return Project::findOrFail($projectID);
} catch (Exception $e) {
return NULL;
}
}
示例11: line_budget
public function line_budget($id)
{
$iterationAux;
$project = Project::findOrFail($id);
$iterations = Iterations::where('projectid', '=', $id)->get();
$string_iterations;
$dataBudgetEstimated = array();
$dataBudgetReal = array();
$dataIterationName = array();
$dataBudgetEstimated[] = 0;
$dataBudgetReal[] = 0;
$dataIterationName[] = '';
foreach ($iterations as $var) {
$dataBudgetEstimated[] = $var->estimatedBudget;
$dataBudgetReal[] = $var->realBudget;
$dataIterationName[] = $var->name;
}
//$string_iterations = implode(";", $iterations);
JpGraph\JpGraph::load();
JpGraph\JpGraph::module('bar');
JpGraph\JpGraph::module('line');
// Some (random) data
$ydata = array(0, 11, 3, 8, 12, 5, 1, 9, 13, 5, 7);
$ydata2 = array(0, 1, 19, 15, 7, 22, 14, 5, 9, 21, 13);
// Size of the overall graph
$width = 800;
$height = 400;
// Create the graph and set a scale.
// These two calls are always required
$graph = new Graph($width, $height);
$graph->SetScale('intlin');
$graph->SetShadow();
// Setup margin and titles
//$graph->img->SetMargin(40,30,40,40);
$graph->SetMargin(40, 50, 40, 40);
$graph->title->Set('GRAFICO LINEAL');
$graph->subtitle->Set('(Presupuesto)');
$graph->title->SetFont(FF_FONT1, FS_BOLD);
//$graph->xaxis->title->Set('Operator');
//$graph->yaxis->title->Set('# of calls');
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->SetTickLabels($dataIterationName);
// Create the first data series
$lineplot = new LinePlot($dataBudgetEstimated);
$lineplot->SetWeight(2);
// Two pixel wide
$lineplot->mark->SetType(MARK_SQUARE);
$lineplot->mark->SetWidth(7);
$lineplot->mark->SetColor('orange');
//$lineplot->mark->SetColor('#A519B5');
$lineplot->mark->SetFillColor('orange');
//$lineplot->mark->SetFillColor('#A519B5');
// Add the plot to the graph
$graph->Add($lineplot);
$lineplot->value->Show();
//$lineplot->value->SetColor("#A519B5");
$lineplot->value->SetColor("orange");
$lineplot->SetLegend('Presupuesto estimado');
// Create the second data series
$lineplot2 = new LinePlot($dataBudgetReal);
/*
MARK_SQUARE, A filled square
MARK_UTRIANGLE, A triangle pointed upwards
MARK_DTRIANGLE, A triangle pointed downwards
MARK_DIAMOND, A diamond
MARK_CIRCLE, A circle
MARK_FILLEDCIRCLE, A filled circle
MARK_CROSS, A cross
MARK_STAR, A star
MARK_X, An 'X'
MARK_LEFTTRIANGLE, A half triangle, vertical line to left (used as group markers for Gantt charts)
MARK_RIGHTTRIANGLE, A half triangle, vertical line to right (used as group markers for Gantt charts)
MARK_FLASH, A Zig-Z
*/
//$lineplot2->SetWeight( 2 ); // Two pixel wide
//$lineplot2->mark->SetType(MARK_DIAMOND);
//$lineplot2->mark->SetColor('#A519B5');
//$lineplot2->mark->SetFillColor('#A519B5');
$lineplot2->mark->SetType(MARK_DIAMOND);
$lineplot2->mark->SetWidth(10);
$lineplot2->mark->SetColor('#A519B5');
//$lineplot2->mark->SetColor('orange');
$lineplot2->mark->SetFillColor('#A519B5');
//$lineplot2->mark->SetFillColor('orange');
// Add the second plot to the graph
$graph->Add($lineplot2);
$lineplot2->SetColor("#00D053");
$lineplot2->SetLegend('Presupuesto real');
$lineplot2->value->Show();
// $lineplot2->value->SetColor("orange");
$lineplot2->value->SetColor("#A519B5");
$graph->legend->SetFrameWeight(2);
$graph->legend->SetFont(FF_FONT1, FS_BOLD);
// Display the graph
$graph->Stroke();
}
示例12: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
return View::make('projects.create')->with('project', Project::findOrFail($id))->with('title', 'Edit Project')->with('method', 'PUT')->with('url', 'projects/' . $id)->with('priorities', Priority::lists('priority_name', 'id'));
}
示例13: click
public function click($id)
{
$project = Project::findOrFail($id);
$project->clicks = $project->clicks + 1;
$project->save();
}
示例14: getTimeSummary
public function getTimeSummary($id)
{
try {
$project = Project::findOrFail($id);
$iterations = sizeof($project->iterations);
$totalEstimatedTime = 0;
$totalRealTime = 0;
$diferencia = 0;
$resultado = 0;
$respuesta = '';
$result = array();
if (!$iterations == 0) {
foreach ($project->iterations as $iteration) {
$totalEstimatedTime += $iteration->estimatedTime;
$totalRealTime += $iteration->realTime;
}
//Aumento
if ($totalEstimatedTime > $totalRealTime) {
$respuesta = $respuesta . 'Existe una reducción del ';
$diferencia = $totalEstimatedTime - $totalRealTime;
//Reduccion
} else {
$respuesta = $respuesta . 'Existe un aumento del ';
$diferencia = $totalRealTime - $totalEstimatedTime;
}
if ($diferencia > 0) {
$resultado = $diferencia / $totalEstimatedTime * 100;
}
$resultado = round($resultado, 2);
$respuesta = $respuesta . $resultado . '% referente al tiempo estimado.';
$result['estimated_time'] = round($totalEstimatedTime, 2);
$result['real_time'] = round($totalRealTime, 2);
$result['result_time'] = $respuesta;
return $result;
} else {
$result['estimated_time'] = $totalEstimatedBudget;
$result['real_time'] = $totalRealBudget;
$result['result_time'] = $respuesta;
return $result;
}
} catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
$organization = app('organization');
return Redirect::to('organization/name/' . $organization->auxName . '/projects')->with('error', 'No existen iteraciones en el proyecto.');
}
}
示例15: update
/**
* Update the specified project in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$project = Project::findOrFail($id);
//1. see if the slug is the same as the original
//2. if it is then we will not validate against right
$all = Input::all();
$rules = Project::$rules;
$validator = $this->validateSlugEdit($all, $project, $rules);
$data = $this->checkPublished($all);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
if (isset($data['image'])) {
$data = $this->uploadFile($data, 'image');
} else {
$data['image'] = $project->image;
}
if (isset($data['image_caption_update'])) {
$this->updateImagesCaption($data['image_caption_update']);
}
if (isset($data['image_order_update'])) {
$this->updateImagesOrder($data['image_order_update']);
}
if (isset($data['images'])) {
$this->projectsService->addImages($project->id, $data['images'], 'Project');
}
$data = $this->checkPublished($data);
// dd($data);
$project->update($data);
return Redirect::route('admin_projects')->withMessage("Updated Project!");
}