/** * Bootstrap the application services. * * @return void */ public function boot(Guard $auth, Request $request) { // view()->composer('*', function ($view) use($auth, $request) { $uri = $request->path(); $uri = explode("/", $uri); $breadcrumb = "<li>Home</li>"; $stopped = false; $menuPath = ""; foreach ($uri as $segment) { if (is_numeric($segment)) { $stopped = true; } else { $breadcrumb .= "<li>" . ucfirst($segment) . "</li>"; if (!$stopped) { $menuPath = $menuPath . "/" . $segment; } } } $allSites = array(); foreach (Site::orderBy('name', 'ASC')->get() as $site) { $allSites[$site->id] = $site->name; } $view->with('user', $auth->user())->with('breadcrumb', $breadcrumb)->with('menupath', $menuPath)->with('siteList', $allSites); }); view()->composer('modals.pressJob', function ($view) use($auth, $request) { $presses = \App\Press::where('site_id', session('site'))->get(); $view->with('presses', $presses); }); }
@extends('front.frontmaster') @section('content') <?php use App\Press; $presses = Press::latest()->get(); ?> @foreach($presses as $press ) <h2>{{$press->title}}</h2> <p>{!!$press->details!!}</p> @endforeach @endsection
/** * 获取不同筛选条件中的值 * @method getCondations * @return [type] [description] */ public function getCondations() { $data['instrument'] = Instrument::select('id', 'name')->get(); $data['press'] = \App\Press::select('id', 'name')->get(); $data['tag'] = \App\Tag::select('id', 'name')->get(); // $data['operator'] = \App\User::select('id', 'name')->with('musics')->whereHas('musics', function ($query) { // $query->groupby('operator'); // })->groupby('id')->get(); $data['operator'] = \App\User::select('id', 'name')->whereHas('musics', function ($query) { $query->groupby('operator'); })->groupby('id')->get(); $data['organizer'] = \App\Organizer::select('id', 'name')->get(); return $data; // $data['status'] = 'sdfsdfsdfsdfsdfsdfsdfdsf'; // return $data; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $presses = Press::findorFail($id); $presses->delete(); return redirect('admin/press'); }