Example #1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $place = Place::with(['city', 'category'])->whereId($id)->first();
     $categories = Category::all();
     $cities = City::all();
     return view('client.placeinfo', compact('place', 'categories', 'cities'));
 }
 public function show($id)
 {
     $id = intval($id);
     $articleInstance = Article::findOrFail($id);
     $categories = Category::all();
     return view('admin.detail')->withArticle($articleInstance)->withCategories($categories)->withId($id);
 }
Example #3
0
 /**
  * Compose the view.
  *
  * @return void
  */
 public function compose(View $view)
 {
     $value = Cache::remember('users', 3, function () {
         return DB::table('users')->get();
     });
     $view->with('tags', Tags::all())->with('categories', Category::all());
 }
 public function items()
 {
     $pages_categories = Category::all();
     $publication_categories = PublicationCategory::all();
     $modules = ['tenders', 'trainings', 'news', 'faqs', 'videos', 'galleries'];
     return view('menuitems.items', compact('pages_categories', 'publication_categories', 'modules'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $category = Category::all();
     $blog = Blog::all();
     $images = Auth::user()->getPhoto();
     return view('beranda.home', ['images' => $images])->with('blog', $blog);
 }
Example #6
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $brand = Brand::all();
     $category = Category::all();
     $user = User::all();
     return view('product.create_new_product', compact('brand', 'category', 'subcat_level1', 'user'));
 }
Example #7
0
 public function getEdit($id)
 {
     $categories = [];
     foreach (Category::all() as $category) {
         $categories[$category->id] = $category->name;
     }
     return view('admin.products.details', ['product' => Product::find($id), 'categories' => $categories]);
 }
 public function all()
 {
     $categories = Category::all();
     if ($categories->isEmpty()) {
         return $this->responseNotFound(['Categories is empty']);
     }
     $categories = $this->parseCategories($categories);
     return $this->responseOk($categories);
 }
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $groupOption = "food";
     $menuOption = "dishes";
     $categories = Category::all();
     $dish = Dish::find($id);
     $selectedCategories = $dish->categories()->get();
     return view('backend.pages.food.editDish')->with(compact('categories', 'dish', 'selectedCategories', 'menuOption', 'groupOption'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $projects = Project::all()->sortByDesc('created_at');
     $categories = Category::all()->sortBy('name');
     //$user = JWTAuth::toUser(JWTAuth::getToken());
     $user = Auth::User();
     //dd($request->all());
     dd($user);
 }
Example #11
0
 public function getCategoryFilter($id)
 {
     $child_categories = [];
     foreach (Category::all() as $category) {
         if ($category->parent_id == $id) {
             $child_categories[] = $category->id;
         }
     }
     return view('products.index', ['products' => Product::whereIn('category_id', Category::find($id)->all_children())->get(), 'category' => Category::find($id), 'child_categories' => Category::whereIn('id', $child_categories)->get()]);
 }
Example #12
0
 public function select()
 {
     $category = Category::all();
     $itemType = ItemType::all();
     $data = [];
     foreach ($this->fields as $field => $default) {
         $data[$field] = old($field, $default);
     }
     return view("admin.item.select", ['category' => $category, 'itemType' => $itemType, 'data' => $data]);
 }
Example #13
0
 public function detail($slag)
 {
     $article = Article::where('slag', $slag)->findOrFail();
     if (!Article::find($article->id + 1)) {
         $article->max = true;
     } else {
         $article->max = false;
     }
     $categories = Category::all();
     return view('article.detail')->withArticle($article)->withCategories($categories)->withId($id);
 }
Example #14
0
 public static function category()
 {
     $return = null;
     $category = Category::all();
     if (count($category)) {
         foreach ($category as $val) {
             $return[$val['cid']] = $val['name'];
         }
     }
     return $return;
 }
 public function get_add_sub_category(Category $category)
 {
     if (!$this->bool_has_role) {
         return $this->roleHelper->call_redirect();
     } else {
         $arr_categories_raw = $category->all()->toArray();
         $arr_categories_processed = $category->process_categories($arr_categories_raw);
         $data = array('arr_logged_in_user' => $this->arr_logged_in_user, 'arr_categories_processed' => $arr_categories_processed);
         return view('test_preparer/add_sub_category')->with('data', $data);
     }
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     // Artisan uses routing, so it tries to retrieve all the categories when doing migrating
     // getting an error
     if (!Schema::hasTable('categories')) {
         return;
     }
     view()->share('categories', Category::all()->take(8));
     //view()->share('cart_total', Cart::total());
     //view()->share('cart_items', count(Cart::content()));
 }
Example #17
0
 public static function _validator($name)
 {
     $requireds = array('validator' => 'notEmpty', 'field' => array('category_id', 'title', 'body'));
     $categories = Category::all('1 ORDER BY RAND()');
     $category = array('validator' => 'oneOfOptions', 'field' => 'category_id', 'options' => $categories);
     $filling = array('validator' => 'notEmpty', 'field' => array('title', 'body'), 'min' => 4);
     switch ($name) {
         case 'add':
         case 'edit':
             return new Validator(array($requireds, $category, $filling), array('categories' => $categories));
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $ss = new SearchService();
     $output = $ss->searchItemsAlgoOne($request);
     if (!$output['status']) {
         print_r("Error occurred getting results " . $output['data']);
         return;
     }
     if ($request->has('category_id')) {
         $category_id = $request->input('category_id');
     } else {
         $category_id = -1;
     }
     // Usage
     if ($request->input('usage') == 'new') {
         $new = 1;
         $used = 0;
         $all = 0;
     } else {
         if ($request->input('usage') == 'used') {
             $new = 0;
             $used = 1;
             $all = 0;
         } else {
             $new = 0;
             $used = 0;
             $all = 1;
         }
     }
     $sortfield_value = "";
     if ($request->has('sortfield')) {
         $sortfield_value = $request->input('sortfield');
     }
     $sort_date = 0;
     $sort_price_asc = 0;
     $sort_price_desc = 0;
     switch ($sortfield_value) {
         case "date_desc":
             $sort_date = 1;
             break;
         case "price_asc":
             $sort_price_asc = 1;
             break;
         case "price_desc":
             $sort_price_desc = 1;
             break;
         default:
             $sort_date = 1;
     }
     $items = $output['data'];
     return view('results.index', ['items' => $items->paginate(9), 'delivery_check' => $request->has('delivery') ? 1 : 0, 'pickup_check' => $request->has('pickup_check') ? 1 : 0, 'freeonly_check' => $request->has('freeonly') ? 1 : 0, 'searchTerm' => $request->input('searchTerm'), 'university_name' => $request->input('university_name'), 'category_id' => $category_id, 'new_check' => $new, 'used_check' => $used, 'all_check' => $all, 'sort_date' => $sort_date, 'sort_price_asc' => $sort_price_asc, 'sort_price_desc' => $sort_price_desc, 'request' => $request->all(), 'university_list' => University::all(), 'category_list' => Category::all()]);
 }
Example #19
0
 private function deleteRecursive($id)
 {
     foreach (Category::all() as $category) {
         if ($category->parent_id == $id) {
             $this->deleteRecursive($category->id);
         }
     }
     $category = Category::find($id);
     if ($category) {
         $this->setCategoryProduct($id);
         $category->delete();
     }
 }
Example #20
0
 protected function elements($defaults)
 {
     $admin = rand(0, 1);
     $elements = array('username' => array('type' => 'text', 'required' => true, 'minlength' => 0), 'firstname' => array('type' => 'text', 'required' => true, 'minlength' => 2), 'middlename' => array('type' => 'text', 'title' => 'Middle name'), 'lastname' => array('type' => 'text', 'required' => true, 'minlength' => 2), 'password' => array('type' => 'text', 'required' => false), 'email' => array('type' => 'text', 'title' => 'E-mail', 'required' => true, 'minlength' => 0, 'validation' => 'email', 'error' => 'Invalid e-mail address, dude...', 'description' => Output::translate('Can be empty, but must otherwise be valid')), 'phone1' => array('type' => 'text', 'title' => 'Phone 1', 'required' => false), 'phone2' => array('type' => 'text', 'title' => 'Phone 2', 'required' => false), 'birthdate' => array('type' => 'date', 'required' => true, 'minlength' => 0, 'validation' => 'date'), 'group' => array('type' => 'dropdown', 'required' => true, 'options' => \app\models\Category::all('category_name <> ?', ''), 'validation' => 'options'), 'secret' => array('type' => 'text'), 'oele' => array('type' => 'text'), array('always' => true, 'require' => array('phone1', 'phone2'), 'validation' => function ($form) {
         if (!$form->input('phone1') && !$form->input('phone2')) {
             return 'Must enter at least 1 phone number';
         }
     }, 'fields' => 'phone1, phone2'), array('require' => array('phone1'), 'validation' => 'phoneNumber', 'fields' => 'phone1'), array('require' => array('phone2'), 'validation' => 'phoneNumber', 'fields' => 'phone2'));
     if (!$admin) {
         unset($elements['secret']);
     }
     return $elements;
 }
 /**
  * Data for Select element
  */
 public static function GetCreateList($id = 0)
 {
     $result = [];
     $list = [];
     if ($id == 0) {
         $list = Category::all();
     } else {
         $list = Category::where('parent_id', '=', $id)->get();
         $list[$list->count()] = Category::find($id);
     }
     foreach ($list as $k => $v) {
         $result[$v->id] = $v->name;
     }
     return $result;
 }
Example #22
0
 public function index($category_id = -1)
 {
     $b4login = session('b4login');
     if (true == Auth::check() && '' != $b4login) {
         session()->forget('b4login');
         return redirect($b4login);
     }
     $title = "All News";
     $categories = Category::all();
     $script = "<script>var category_id = {$category_id};</script>";
     if ($category_id >= 0) {
         $category = Category::find($category_id);
         $title = $category->name . " News";
     }
     $navEntries = $this->buildNav($categories, $category_id);
     $hotNews = $this->news->hotNews($category_id);
     $trendingNews = $this->news->trendingNews($category_id);
     return view('pages.home', ['ngController' => 'HomeController', 'title' => $title, 'navEntries' => $navEntries, 'category_id' => $category_id, 'hotNews' => $hotNews->toArray(), 'trendingNews' => $trendingNews->toArray(), 'script' => $script]);
 }
 protected function elements($defaults)
 {
     $this->options->oninput = 'this.op.value=this.username.value;';
     return array(array('type' => 'markup', 'inside' => function ($form) {
         return 'Username: <output name="op" xoninput="alert(this);this.value=this.form.username.value;">...</output>';
     }), 'username' => array('type' => 'text', 'required' => true, 'minlength' => 2, 'validation' => function ($form) {
         $db = $form->application->db;
         $usernameExists = models\User::count(array('username' => $form->input('username')));
         return $usernameExists ? 'This username is taken' : true;
     }, 'description' => Output::translate('Have you read our %1?', array(Output::ajaxLink(Output::translate('username guidelines', null, array('ucfirst' => false)), 'blog/page/username')))), 'password' => array('type' => 'password', 'required' => true, 'minlength' => 0), 'color' => array('title' => 'Favourite colour', 'type' => 'colour', 'required' => true, 'minlength' => 2, 'default' => 'white'), 'category' => array('title' => 'Favourite blog category', 'type' => 'options', 'options' => \app\models\Category::all('category_name <> ?', ''), 'dummy' => '-- I have not the favourite', 'validation' => function ($form, $name) {
         if ('' == $form->input($name, '')) {
             // Can be empty
             $form->output($name, null);
             return true;
         }
         return $form->validateOptions($form, $name);
     }), 'birthdate' => array('title' => 'When\'s your dob?', 'type' => 'date', 'required' => true, 'validation' => 'date', 'default' => 'YYYY-MM-DD'), 'bio' => array('type' => 'textarea', 'required' => true, 'minlength' => 0, 'rows' => 5, 'regex' => '.*\\w\\s\\w.*'), array('type' => 'markup', 'outside' => '<fieldset><legend>' . Output::translate('Options') . '</legend>'), 'stupid' => array('type' => 'checkbox', 'required' => true, 'name' => 'options[stupid]'), 'this' => array('type' => 'checkbox', 'name' => 'options[this]'), 'that' => array('type' => 'checkbox', 'name' => 'options[that]'), array('type' => 'markup', 'outside' => '</fieldset>'), 'email' => array('type' => 'email', 'required' => true, 'validation' => 'email', 'description' => Output::translate('Only used for account activation. <strong>We won\'t store this.</strong>')), 'gender' => array('type' => 'radio', 'required' => true, 'options' => array('m' => Output::translate('Male'), 'f' => Output::translate('Female'))), 'hobbies' => array('type' => 'checkboxes', 'options' => models\Category::all(), 'required' => true, 'minlength' => 2, 'name' => 'misc[hobbies][]'), array('type' => 'markup', 'outside' => '<fieldset><legend>Terms</legend>'), 'terms' => array('type' => 'checkbox', 'title' => Output::translate('I very much do agree on the terms yes yes'), 'description' => 'Do you really? Huh? <b>Well?? Do ya??</b>', 'required' => true), array('type' => 'markup', 'outside' => '</fieldset>'), array('validation' => function ($form) {
         return strlen($form->input('username')) <= strlen($form->input('password'));
     }, 'fields' => 'password', 'message' => 'Your password must be at least as long as your username'), array('require' => 'username', 'validation' => function ($form) {
         $usr = strtolower($form->input('username'));
         $clr = strtolower($form->input('color'));
         return !is_int(strpos($usr, $clr)) && !is_int(strpos($clr, $usr));
     }, 'fields' => array('username', 'color'), 'message' => 'Username cannot contain Colour and vice versa'));
 }
Example #24
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     if ($request->has('q')) {
         $needle = trim($request->input('q'));
         return view('index', ['videos' => Video::withAllTags($needle)->paginate(20)->appends(['q' => $needle]), 'categories' => Category::all(), 'q' => $needle]);
         // $pdo = \DB::connection()->getPdo();
         // $needle = '%' . trim($request->input('q')) .'%';
         // `songindex` will need to be changed due to the view name being changed to index.
         // return view('songindex', [
         //     'videos' => Video::where(function($query) use($needle) {
         //         $query->where('interpret', 'LIKE', $needle)
         //             ->orWhere('songtitle', 'LIKE', $needle)
         //             ->orWhere('imgsource', 'LIKE', $needle);
         //     })
         //             //->orderBy('id', 'ASC')
         //             ->orderByRaw("((interpret like " . $pdo->quote($needle) . ") +
         //                 (songtitle like " . $pdo->quote($needle) . ") +
         //                 (imgsource like " . $pdo->quote($needle) . ")) desc")
         //             ->paginate(20)->appends(['q' => trim($needle, '%')]),
         //     'categories' => Category::all()
         // ]);
     }
     return view('index', ['videos' => Video::orderBy('id', 'ASC')->paginate(20), 'categories' => Category::all()]);
 }
Example #25
0
 public function all($type = Null, $criteria = Null)
 {
     switch ($type) {
         case "project":
             if ($criteria != Null) {
                 $lists = \App\Models\Project::where('status', $criteria)->count();
             } else {
                 $lists = \App\Models\Project::all()->count();
             }
             break;
         case "user":
             $lists = \App\User::all()->count();
             break;
         case "category":
             $lists = \App\Models\Category::all()->count();
             break;
         case "genre":
             $lists = \App\Models\Genre::all()->count();
             break;
         default:
             $lists = 0;
     }
     return $lists;
 }
Example #26
0
 /**
  * show the form for editing the specified resource.
  *
  * @param $id
  *
  * @return string
  */
 public function edit($id)
 {
     $cats = array();
     $users = array();
     $categories = Category::all()->toArray();
     $u = User::all()->toArray();
     foreach ($categories as $key => $value) {
         $cats[$value['id']] = $value['name'];
     }
     foreach ($u as $key => $value) {
         $users[$value['id']] = $value['username'];
     }
     $article = Article::find($id);
     return view('backend.article_edit', ['categories' => $cats, 'users' => $users, 'article' => $article, 'load_js' => 'backend/article.edit', 'load_css' => '']);
 }
Example #27
0
      <a class="navbar-brand" href="{{URL::to('home')}}">Home</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li class="active"><a href="{{URL::to('home')}}">Trang chủ</a></li>

        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Loại Tin Tức <b class="caret"></b></a>
          <ul class="dropdown-menu">
          <?php 
use App\Models\Category;
?>
           <?php 
$cats = Category::all();
?>
           @foreach ($cats as $cat)
                  <li><a href="{{URL::to('type',$cat->catId)}}"><?php 
echo $cat->catName;
?>
</a></li>
           @endforeach
          </ul>
        </li>
        <li><a href="{{URL::to('contact')}}">Liên hệ</a></li>
        <li><a href="{{URL::to('about')}}">Giới Thiệu</a></li>
      </ul>

      <ul class="nav navbar-nav navbar-right">
        <li style="width:500px;padding-top:10px;">
 /**
  * Send categories variable to side.navigation partial
  * @return void
  */
 private function composeSidebarNavigation()
 {
     view()->composer('store.side-navigation', function ($view) {
         $view->with('categories', Category::all()->toHierarchy());
     });
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $categories = \App\Models\Category::all();
     return view('portfolio', ['categories' => $categories]);
 }
 /**
  * Display a listing of the Category.
  *
  * @return Response
  */
 public function index()
 {
     $categories = Category::all();
     return view('admin.categories.index')->with('categories', $categories);
 }