public function __construct(Reservation $reservation)
 {
     $this->reservation = $reservation;
     View::share('locations', Location::orderBy('name', 'asc')->get());
     View::share('types', Type::orderBy('name', 'asc')->get());
     View::share('news', Post::where('post_type', 'news')->orderBy('created_at', 'desc')->limit(4)->get());
 }
Exemplo n.º 2
0
 public function getIndex()
 {
     $key = Input::get('search');
     if (isset($key)) {
         $data = Type::where('name', 'like', '%' . $key . '%')->orderBy('id', 'desc')->paginate(10);
     } else {
         $data = Type::orderBy('id', 'desc')->paginate(10);
     }
     return View::make('home/dashboard', array())->nest('content', 'Type/index', array('data' => $data));
 }
 public function __construct()
 {
     View::share('page_title', 'Client');
     View::share('locations', Location::orderBy('name', 'asc')->get());
     View::share('types', Type::orderBy('name', 'asc')->get());
     View::share('news', Post::where('post_type', 'news')->orderBy('created_at', 'desc')->limit(4)->get());
     if (Sentry::check()) {
         View::share('user', Sentry::getUser());
         $this->user = Sentry::getUser();
     }
 }
 public static function dropdown($novalue = null)
 {
     $locations = Type::orderBy('name')->get();
     $array = array();
     if ($novalue) {
         $array = array('' => 'Any');
     }
     foreach ($locations as $l) {
         $key = $l->id;
         $array[$key] = ucwords($l->name);
     }
     return $array;
 }
Exemplo n.º 5
0
 public static function getTypes()
 {
     $arrData = [];
     if (Cache::has('types')) {
         $arrData = Cache::get('types');
     } else {
         $types = Type::orderBy('order_no')->get();
         $arrData = [];
         if (!$types->isEmpty()) {
             $arrData = $types->toArray();
         }
         Cache::forever('types', $arrData);
     }
     return $arrData;
 }
Exemplo n.º 6
0
 public function getContent($type_id = 'content', $id = 'edit')
 {
     if ($type_id == 'content' && $id == 'edit') {
         $posts = Type::orderBy('created_at', 'desc')->get();
         return View::make('admin.content')->with('posts', $posts);
     }
     $posts = Post::where('type_id', '=', $type_id)->where('parent', '=', '0')->orderBy('created_at', 'desc')->get();
     $posts_child = Post::where('type_id', '=', $type_id)->where('parent', '!=', '0')->orderBy('created_at', 'desc')->get();
     $view = array('posts' => $posts, 'posts_child' => $posts_child, 'type_id' => $type_id);
     $templates = array('page' => 'Текст', 'gallery' => 'Галерея');
     //добавляем категорию
     if ($type_id == 'type' && $id == 'add') {
         $view['templates'] = $templates;
         return View::make('admin.post-type', $view);
     }
     //редактируем категорию
     if ($id == 'edit') {
         $post = Type::where('id', $type_id)->first();
         $view['row'] = $post;
         $view['templates'] = $templates;
         return View::make('admin.post-type', $view);
     } else {
         if (is_numeric($id) || $id == 'add') {
             $post = Post::find($id);
             $galleries = Gallery::where('post_id', $id)->get();
             $parent[0] = '';
             foreach ($posts as $value) {
                 if ($value->id != $id) {
                     $parent[$value['id']] = $value['name'];
                 }
             }
             $view['galleries'] = $galleries;
             $view['parent'] = $parent;
             $view['row'] = $post;
             return View::make('admin.posts', $view);
         }
     }
 }