public function pdf($id)
 {
     /// only admin
     $brief = Brief::findOrFail($id);
     $pdf = PDF::loadView('briefs.pdf', compact('briefs'));
     return $pdf->stream();
 }
 public function update_brief(EditBriefRequest $request, $id)
 {
     $id_user = Auth::user()->id;
     $briefs = Brief::findOrFail($id);
     $file_old = $briefs->file;
     if ($request->file('file')) {
         $file = $request->file('file');
         $name = 'Appmm_' . time() . '.' . $file->getClientOriginalExtension();
         $path = public_path() . '/upload/projects/briefs/';
         $file->move($path, $name);
         Storage::delete($path . $file_old);
     }
     $briefs->iduser_update = $id_user;
     // $briefs->file->$name;
     $briefs->fill($request->all());
     $briefs->save();
     Session::flash('message', ' Se actualizo exitosamente el Brief del proyecto ' . $briefs->project->name);
     $role = Auth::user()->role;
     if ($role == 'developer' || $role == 'agent') {
         return redirect()->route('projectos.index');
     } elseif ($role == 'admin') {
         return redirect()->route('admin.projectos.index');
     }
 }
예제 #3
0
 public static function filter($date)
 {
     return Brief::date($date)->orderBy('created_at', 'DESC')->paginate(5);
 }