コード例 #1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($slug)
 {
     $area = 'whats-on';
     $page = \Crockenhill\Meeting::where('slug', $slug)->first();
     $heading = $page->heading;
     $breadcrumbs = '<li><a href="whats-on">What\'s On </a> <li class="active">' . $page->heading . '</li>';
     $description = '<meta name="description" content="' . $page->description . '">';
     $content = $page->body;
     $type = $page->type;
     $starttime = $page->StartTime;
     $endtime = $page->EndTime;
     $day = $page->day;
     $location = $page->location;
     $who = $page->who;
     $phone = $page->LeadersPhone;
     $email = $page->LeadersEmail;
     //Photos
     if ($page->pictures === '1') {
         $filelist = scandir($_SERVER['DOCUMENT_ROOT'] . '/images/meetings/' . $slug);
         $photos = array_slice($filelist, 2);
     } else {
         $photos = '';
     }
     return view('meetings.meeting', array('slug' => $slug, 'heading' => $heading, 'description' => $description, 'area' => $area, 'breadcrumbs' => $breadcrumbs, 'content' => $content, 'type' => $type, 'starttime' => $starttime, 'endtime' => $endtime, 'day' => $day, 'location' => $location, 'who' => $who, 'phone' => $phone, 'email' => $email, 'photos' => $photos));
 }
コード例 #2
0
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     \View::composer('includes.header', function ($view) {
         $pages = array('AboutUs' => array('route' => 'about-us', 'name' => 'About Us'), 'WhatsOn' => array('route' => 'whats-on', 'name' => 'What\'s On'), 'FindUs' => array('route' => 'find-us', 'name' => 'Find Us'), 'ContactUs' => array('route' => 'contact-us', 'name' => 'Contact Us'), 'Sermons' => array('route' => 'sermons', 'name' => 'Sermons'), 'Members' => array('route' => 'members', 'name' => 'Members'));
         $view->with('pages', $pages);
     });
     \View::composer('includes.footer', function ($view) {
         //get the latest sermons
         $morning = \Crockenhill\Sermon::where('service', 'morning')->orderBy('date', 'desc')->first();
         $evening = \Crockenhill\Sermon::where('service', 'evening')->orderBy('date', 'desc')->first();
         // and create the view composer
         $view->with('morning', $morning);
         $view->with('evening', $evening);
     });
     \View::composer('layouts.members', function ($view) {
         $area = 'members';
         $links = \Crockenhill\Page::where('area', $area)->orderBy(\DB::raw('RAND()'))->take(5)->get();
         $view->with('links', $links);
     });
     \View::composer('page', function ($view) {
         if (\Request::segment(2)) {
             $slug = \Request::segment(2);
             $area = \Request::segment(1);
         } else {
             $slug = \Request::segment(1);
             $area = \Request::segment(1);
         }
         $headingpicture = '/images/headings/large/' . $slug . '.jpg';
         if ($area != 'whats-on') {
             $links = \Crockenhill\Page::where('area', $area)->where('slug', '!=', $slug)->where('slug', '!=', $area)->take(5)->get();
         } else {
             $links = \Crockenhill\Meeting::where('slug', '!=', $slug)->get();
         }
         $view->with('headingpicture', $headingpicture);
         $view->with('links', $links);
     });
 }