/** * Handle an incoming request. * Determines if the user is the administrator of the website. * The administrator is the first user of the database. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|null $guard * @return mixed */ public function handle($request, Closure $next, $guard = null) { $itemtypes = Itemtype::all(); Session::forget('itemtypes'); Session::put('itemtypes', $itemtypes); $biblios = Biblio::all(); Session::forget('biblios'); Session::put('biblios', $biblios); return $next($request); }
public function index() { if (!Session::has('biblio_id')) { flash()->error('Please select a Library'); return view('admin.records.index', ['records' => []]); } $biblio = Biblio::with(array('records' => function ($query) { $query->with(array('fields' => function ($query) { $query->join('marcsubfields', 'records_fields.tagsubfield', '=', 'marcsubfields.id')->join('marcfields', 'marcsubfields.tagfield', '=', 'marcfields.id')->where('marcfields.tagfield', '200')->where('marcsubfields.tagsubfield', 'a')->get(); }))->with('itemtype'); }))->find(Session::get('biblio_id')); return view('admin.records.index', compact('biblio')); }
/** * Show the view with the details of a Record * * @param $id the id of the Record to show */ public function showRecordsDetails($id) { $record = Record::findOrFail($id)->with(array('fields' => function ($query) { $query->join('marcsubfields', 'records_fields.tagsubfield', '=', 'marcsubfields.id')->join('marcfields', 'marcsubfields.tagfield', '=', 'marcfields.id')->select('marcfields.description as field', 'marcsubfields.description as subfield', 'records_fields.*', 'marcfields.tagfield as tagfield', 'marcsubfields.tagsubfield as tagsubfield', 'marcsubfields.hidden')->orderBy('marcfields.id')->get(); }))->where('records.id', '=', $id)->with('itemtype')->get(); $biblios = Biblio::All(); return view('detail', ['record' => $record, 'biblios' => $biblios]); }
/** * Sets the session variable biblio */ public function change($id) { $biblio = Biblio::findOrFail($id); Session::put('biblio_id', $id); Session::put('biblio_name', $biblio->name); return redirect()->back(); }
/** * Show the application dashboard. * * @return \Illuminate\Http\Response */ public function advancedSearch() { $biblios = Biblio::All(); return view('advancedSearch', compact('biblios')); }