public function delete($filter, $id) { if (filter_optie::destroy($id)) { return redirect('filters/' . $filter)->with('succesMsg', '<span class="glyphicon glyphicon-ok"></span> Het item is succesvol verwijderd.'); } else { return redirect('filters/' . $filter)->with('errorMsg', '<span class="glyphicon glyphicon-ok"></span> Er is iets fout gegaan met het verwijderen. Probeer het nog een keer.'); } }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { view()->composer('*', function ($view) { $filterData = filter_optie::orderBy('naam')->get(); $artists = Artist::orderBy('name')->get(); $newarray = array(); foreach ($filterData as $filter) { $newarray[$filter->filter_id][$filter->naam] = $filter->naam; } view()->share(['newarray' => $newarray, 'artists' => $artists]); }); return $next($request); }
/** * Show the form for editing the specified resource. * * @param string $slug * @return Response */ public function edit($slug) { // get the artwork $artwork = Artwork::where('slug', $slug)->first(); // Does the artwork exist? if ($artwork) { // Get the selectbox options and pass them to the view via the compact function. $artists = Artist::orderBy('name')->get(); $categories = filter_optie::where('filter_id', '=', 1)->where('id', '>', 5)->orderBy('naam')->get(); $genres = filter_optie::where('filter_id', '=', 2)->where('id', '>', 5)->orderBy('naam')->get(); $techniques = filter_optie::where('filter_id', '=', 3)->where('id', '>', 5)->orderBy('naam')->get(); $materials = filter_optie::where('filter_id', '=', 4)->where('id', '>', 5)->orderBy('naam')->get(); $colours = filter_optie::where('filter_id', '=', 5)->where('id', '>', 5)->orderBy('naam')->get(); $formats = array('Klein', 'Middelgroot', 'Groot'); $filterArray = ['artwork', 'artists', 'techniques', 'genres', 'materials', 'categories', 'formats', 'colours']; // Show the view return View::make('artworks/edit', compact($filterArray)); } else { // Show the not found page return View::make('errors/' . HttpCode::NotFound); } }