本文整理汇总了PHP中app\Project::findBySlug方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::findBySlug方法的具体用法?PHP Project::findBySlug怎么用?PHP Project::findBySlug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Project
的用法示例。
在下文中一共展示了Project::findBySlug方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: evaluate
public function evaluate($project)
{
$tech = Project::findBySlug($project);
$valores = $tech->respuestas;
$trl = $valores->sum('respuesta');
$tipo = $tech->tipo;
if ($tipo != "producto") {
$split = 50;
} else {
$split = 45;
}
return view('trl.evaluation', compact('trl', 'tech', 'split'));
}
示例2: answers
public function answers($slug)
{
$data = Project::findBySlug($slug);
$valores = $data->respuestas;
$trl = $valores->sum('respuesta');
$tipo = $data->tipo;
if ($tipo != "producto") {
$split = 50;
} else {
$split = 45;
}
$view = View::make('report.respuestas', compact('data', 'trl', 'split'))->render();
$pdf = \App::make('dompdf.wrapper');
$pdf->loadHTML($view)->setOrientation('landscape');
return $pdf->stream('reporte.pdf');
}
示例3: show
/**
* Display the specified resource.
*
* @param $project
* @param $slug
* @return Response
* @internal param int $id
*/
public function show($project, $slug)
{
$project = Project::findBySlug($project);
$modulo = Modulo::findBySlug($slug);
return view('modulos.show', compact('modulo', 'project'));
}
示例4: showSlug
public function showSlug($slug)
{
$project = Project::findBySlug($slug);
return view('project', ['project' => $project]);
}
示例5: destroy
/**
* Remove the specified resource from storage.
*
* @param $slug
* @return Response
* @internal param int $id
*/
public function destroy($slug)
{
if (Auth::user()->admin === 1) {
$p = Project::findBySlug($slug);
$r = count($p->respuestas);
if ($r > 0) {
$resp = Respuesta::where('project_id', $p->id)->get();
foreach ($resp as $r) {
$r->delete();
}
}
$user = User::where('id', $p->user_id)->get();
\Mail::send('emails.deleted', [], function ($m) use($user) {
$m->to($user[0]['email'], $user[0]['name'])->subject('Proyecto Eliminado');
});
$p->delete();
return Redirect::route('profile.index');
} else {
notify()->flash('No tienes permiso de borrar directorios', 'error', ['timer' => 1500, 'text' => 'GCDN 2015 ® | Derechos Reservados']);
return Redirect::route('profile.index');
}
}