public function __construct() { View::share('logbooks_visible', Logbook::inOverview()->get()); if (Auth::check()) { View::share('user_logbook', Logbook::where('user_id', Auth::user()->id)->first()); } View::share('recent_tasks', Task::open()->oldest()->take(5)->get()); }
public function mahasiswacetaklogbook() { $admin = Admin::where('user_id', Sentry::getUser()->id)->first(); Session::put('mslogname', $admin->name); Session::put('mslognim', $admin->noi); Session::put('msjabatan', $admin->position->name); $mlogbooks = Logbook::where('user_id', Sentry::getUser()->id)->get(); return $this->exportmahasiswalogbook($mlogbooks); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($user_id) { $entry = User::findOrFail($user_id); $user = $entry['username']; $entry->delete(); $count = Logbook::where('user_id', '=', $user_id)->count(); $logbooks = Logbook::where('user_id', '=', $user_id)->update(array('user_id' => 0)); $tasks = Task::where('user_id', '=', $user_id)->update(array('user_id' => 0)); $attachments = Attachment::where('user_id', '=', $user_id)->update(array('user_id' => 0)); if ($count == 1) { return Redirect::to(route('settings.index'))->with('message', ['content' => 'Gebruiker met succes verwijderd! Let op, ' . $count . ' logboek van gebruiker ' . $user . ' is veranderd naar eigenaar Systeem!', 'class' => 'warning']); } else { if ($count > 1) { return Redirect::to(route('settings.index'))->with('message', ['content' => 'Gebruiker met succes verwijderd! Let op, ' . $count . ' logboeken van gebruiker ' . $user . ' zijn veranderd naar eigenaar Systeem!', 'class' => 'warning']); } } return Redirect::to(route('settings.index'))->with('message', ['content' => 'Gebruiker met succes verwijderd!', 'class' => 'success']); }
/** * Display a listing of logs * * @return Response */ public function index() { $logs = Logbook::where('user_id', Sentry::getUser()->id)->get(); return View::make('logs.index', compact('logs'))->withTitle('Log Book'); }