/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     // obtnemos las categorias
     $categories = Category::orderBy('id', 'ASC')->paginate(5);
     // le enviamos las categorias
     return view('admin.categories.index')->with('categories', $categories);
 }
 public function index()
 {
     //get all the categories
     $categories = Category::orderBy("category_id", "ASC")->paginate(20);
     //load the view and pass the categories
     return view('categories.index')->with('categories', $categories);
 }
 public function compose(View $view)
 {
     $tags = Tag::orderBy('id', 'DESC')->get();
     $categories = Category::orderBy('id', 'DESC')->simplepaginate(7);
     $images = Image::orderBy('id', 'DESC')->paginate(4);
     $view->with('tags', $tags)->with('categories', $categories)->with('images', $images);
 }
 public function camposEdicion($id)
 {
     $product = null;
     if ($id != null) {
         $product = Product::findOrFail($id);
     }
     $categories = Category::orderBy('name', 'asc')->get();
     $arrayCat = null;
     $arrayCol = null;
     $checked = null;
     foreach ($categories as $cat) {
         $arrayCat[$cat->id] = $cat->name;
     }
     $colors = Color::orderBy('name', 'asc')->get();
     foreach ($colors as $col) {
         $arrayCol[$col->id] = ['name' => $col->name, 'checked' => ""];
         if (isset($product)) {
             $checkColor = ProductColor::where('id_product', $product->id)->where('id_color', $col->id)->count();
             if ($checkColor > 0) {
                 $arrayCol[$col->id]['checked'] = "checked";
             }
         }
     }
     return ['arrayCat' => $arrayCat, 'colors' => $arrayCol, 'product' => $product];
 }
Example #5
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $cities = City::all();
     // Grab all the cities and then do a for each.
     // run this for each of them.
     foreach ($cities as $city) {
         $events = Event::where('city_id', '=', $city->id)->where('time_end', '>=', date('Y-m-d H:i:s'))->where('time_end', '<=', date('Y-m-d H:i:s', strtotime('+2 weeks')))->orderBy('time_start', 'asc')->get();
         if (!count($events)) {
             $this->comment('No events found for ' . $city->name . '. Mailer not sent.');
             continue;
         }
         $categories = Category::orderBy('title', 'asc')->get();
         if ($this->option('email')) {
             $subscriber = new Subscriber();
             $subscriber->name = 'Test User';
             $subscriber->email = $this->option('email');
             $subscribers = [$subscriber];
             $this->comment('Sent test email to ' . $this->option('email'));
         } else {
             $subscribers = Subscriber::where('city_id', '=', $city->id)->get();
         }
         $count = 0;
         foreach ($subscribers as $subscriber) {
             Mail::send('emails.subscribers.mailer', ['subscriber' => $subscriber, 'events' => $events, 'categories' => $categories, 'city' => $city], function ($m) use($subscriber, $city) {
                 $m->from('*****@*****.**', 'See+Do')->to($subscriber->email, $subscriber->name)->subject('Weekly Round-Up of Things to See+Do in ' . $city->name)->getHeaders()->addTextHeader('X-MC-Subaccount', 'see-do');
             });
             $count++;
         }
         $this->comment('Sent to ' . $count . ' email addresses in ' . $city->name . '.');
         $count = 0;
     }
 }
Example #6
0
 public function compose(View $view)
 {
     $categories = Cache::remember('categories', 1440, function () {
         return Category::orderBy('name')->get();
     });
     $view->with(['user' => $this->auth->user(), 'categories' => $categories, 'guest' => !$this->auth->check()]);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $article = Article::find($id);
     $categories = Category::orderBy('name', 'DESC')->lists('name', 'id');
     $tags = Tag::orderBy('name', 'DESC')->lists('name', 'id');
     $my_tags = $article->tags->lists('id')->toArray();
     return view('admin.articles.edit')->with('categories', $categories)->with('tags', $tags)->with('article', $article)->with('my_tags', $my_tags);
 }
Example #8
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $service = Service::findOrFail($id);
     $currencies = ['hrk' => 'HRK', 'usd' => 'USD', 'eur' => 'EUR'];
     $clients = Client::orderBy('name')->pluck('name', 'id')->toArray();
     $categories = Category::orderBy('name')->pluck('name', 'id')->toArray();
     return view('services.edit')->with(compact('service', 'currencies', 'clients', 'categories'));
 }
Example #9
0
 /**
  * 获取分类列表
  *
  * @param string  $taxonomy 
  * @param array   $credential 
  * @param boolean $tree
  *
  * @return object
  */
 public static function getAll(Closure $callback = null)
 {
     $terms = Category::orderBy('id', 'desc');
     if ($callback) {
         $callback($terms);
     }
     return $terms->get();
 }
Example #10
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $pages = Category::orderBy('parent_id', 'ASC')->orderBy('category_order', 'ASC')->get()->toArray();
     $Tree = new Tree();
     $tree = $Tree->buildTree($pages);
     list($keys, $values) = array_divide($tree);
     return $values;
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $articles = Article::OrderBy('id', 'DESC')->paginate(7);
     $categories = Category::orderBy('name', 'ASC')->get();
     $tags = Tag::orderBy('name', 'ASC')->get();
     $images = Image::orderBy('article_id', 'DESC')->get();
     return view('admin.index')->with('articles', $articles)->with('tags', $tags)->with('images', $images)->with('categories', $categories);
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     $categories = [];
     if (Schema::hasTable('categories')) {
         $categories = App\Category::orderBy('name')->get();
     }
     view()->share(compact('categories'));
 }
Example #13
0
 public function edit($id)
 {
     $post = Post::where('id', $id)->first();
     $categories = Category::orderBy('name')->get();
     if (empty($post)) {
         return Redirect::route('administration.index');
     }
     return view('administration.blog.edit', ['post' => $post, 'categories' => $categories]);
 }
 public function edit($id)
 {
     $article = Article::find($id);
     $article->category;
     $categories = Category::orderBy('name', 'DESC')->lists('name', 'id');
     $tags = Tag::orderBy('name', 'DESC')->lists('name', 'id');
     $my_tags = $article->tags->lists('id')->ToArray();
     return view('admin.articles.edit')->with(['categories' => $categories, 'article' => $article, 'tags' => $tags, 'my_tags' => $my_tags]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $categories = Category::orderBy('order')->get()->toArray();
     foreach ($categories as &$c) {
         $c['action'] = array('create' => Config::get('app.url') . '/category/' . $c['id'] . '/posts/create', 'view' => Config::get('app.url') . '/category/' . $c['id'] . '/posts');
     }
     $index = new Collection();
     $index['data'] = $categories;
     return response()->json($index);
 }
 /**
  * The order page
  */
 public function order()
 {
     $Category = $this->Category->findOrFail(Input::get('id'));
     if ($Category->parent_id == 0) {
         $assign['categorys'] = $this->Category->orderBy('weight', 'asc')->whereRaw('parent_id = 0 and type_id = ' . $Category->type_id)->get();
     } else {
         $assign['categorys'] = $this->Category->orderBy('weight', 'asc')->where('parent_id', '=', $Category->parent_id)->get();
     }
     return view('dashboard.category.order', $assign);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $tag = Keyword::findOrFail($id);
     $categories = Category::orderBy('name')->get();
     $selector = array();
     foreach ($categories as $category) {
         $selector[$category->id] = $category->name;
     }
     return view('admin.updateKeyword', ['tag' => $tag, 'categories' => $selector]);
 }
Example #18
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $widget = Widget::findOrFail($id);
     if (!$this->adminOrCurrentUserOwns($widget)) {
         throw new UnauthorizedException();
     }
     $categories = Category::orderBy('category_name', 'asc')->lists('category_name', 'id');
     $subcategories = Subcategory::orderBy('subcategory_name', 'asc')->where('category_id', '=', $widget->category_id)->lists('subcategory_name', 'id');
     return view('widget.edit', compact('widget', 'categories', 'subcategories'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $opp = array();
     $categories = Category::orderBy('id', 'DESC')->get();
     $title = "Catégories";
     $options = Option::all();
     foreach ($options as $o) {
         $opp[$o->category_id][$o->id] = $o;
     }
     return view('Categories/categories', ['title' => $title, 'categories' => $categories, 'opp' => $opp]);
 }
Example #20
0
 /**
  * Display the specified resource.
  *
  * @param Category $category
  *
  * @return \Illuminate\Http\Response
  */
 public function show(City $city, Category $category)
 {
     // overwrite the given category with one that has the same slug and the right cityID,
     // this wouldn't be a problem if we used unique slugs but its better to be consistent with
     // the category urls
     $category = Category::where([['city_id', '=', $city->id], ['slug', '=', $category->slug]])->first();
     $event = null;
     $events = $category->futureEvents($city)->get();
     $categories = Category::orderBy('title', 'asc')->get();
     return view('events.index', compact('city', 'events', 'event', 'category', 'categories'));
 }
Example #21
0
 public function index(Request $request)
 {
     $search = \Request::get('search');
     //<-- we use global request to get the param of URI
     if ($search) {
         $allCategory = Category::whereRaw('category_name = ?', [$search])->orderBy('id', 'asc')->paginate(5);
     } else {
         $allCategory = Category::orderBy('id', 'asc')->paginate(5);
     }
     return view('Category.index', ['Categories' => $allCategory]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $keyword = $request->input('keyword') ? $request->input('keyword') : '';
     $categories = [];
     if ($request->input('keyword')) {
         $categories = Category::where('name', 'LIKE', '%' . spaceToLike($request->input('keyword')) . '%')->orderBy('order')->get();
     } else {
         $categories = Category::orderBy('order')->get();
     }
     return view('admin.category.content', ['categories' => $categories, 'keyword' => $keyword]);
 }
Example #23
0
 /**
  * Display a dynamically generated mailer based on data available now.
  *
  * @return \Illuminate\Http\Response
  */
 public function now()
 {
     $events = Event::futureEvents()->get();
     $categories = Category::orderBy('title', 'asc')->get();
     $subscriber = new Subscriber();
     $subscriber->name = 'Andy Gott';
     $subscriber->email = '*****@*****.**';
     Mail::send('emails.subscribers.mailer', ['subscriber' => $subscriber, 'events' => $events, 'categories' => $categories], function ($m) use($subscriber) {
         $m->from('*****@*****.**', 'See+Do')->to($subscriber->email, $subscriber->name)->subject('Weekly Round-Up of Things to See+Do in Manchester')->getHeaders()->addTextHeader('X-MC-Subaccount', 'see-do');
     });
     return view('mailers.now', compact('events'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $categories = Category::orderBy('name')->get();
     foreach ($categories as $category) {
         // $dropbox = Dropbox::createTemporaryDirectLink($category->featured_image);
         // $category->featured_image = $dropbox[0];
         if ($category->featured_image != '') {
             $dropbox = Dropbox::getThumbnail($category->featured_image, "jpeg", "m");
             $category->featured_image = 'data:image/jpeg;base64,' . base64_encode($dropbox[1]);
         } else {
             $category->featured_image = "http://placehold.it/128x128/ecf0f5/444444?text=&#63;";
         }
     }
     return view('auth.categories.index')->withCategories($categories);
 }
Example #25
0
 /**
  * Show the report for all things.
  *
  * @return [type]
  */
 public function report()
 {
     $services = Service::orderBy('month')->orderBy('day')->where('active', 1)->with(['client', 'category'])->get();
     $clients = Client::orderBy('name')->whereHas('services', function ($query) {
         $query->where('active', 1);
     })->with(['services' => function ($query) {
         $query->where('active', 1);
     }])->get();
     $categories = Category::orderBy('name')->whereHas('services', function ($query) {
         $query->where('active', 1);
     })->with(['services' => function ($query) {
         $query->where('active', 1);
     }])->get();
     return view('report')->with(compact('services', 'clients', 'categories'));
 }
 public function showList(Request $request)
 {
     $type = $request->get('show');
     $categories = Category::orderBy('name');
     switch ($type) {
         case 'store':
             $categories->store();
             break;
         case 'group':
             $categories->group();
             break;
     }
     $categories = $categories->get()->buildTree();
     $panel = ['left' => ['width' => '2'], 'center' => ['width' => '10']];
     return view('categories.home', compact('categories', 'panel'));
 }
Example #27
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['event_name' => 'required', 'event_description' => 'required', 'event_datetime' => 'required']);
     $event = new Event();
     $event->is_published = $request->get('is_published') == 'on' ? 1 : 0;
     $event->name = $request->event_name;
     $event->description = $request->event_description;
     $event->datetime = Carbon::parse($request->event_datetime);
     $event->save();
     if ($request->get('event_categories') != null) {
         foreach ($request->get('event_categories') as $category_id) {
             $event->categories()->attach($category_id);
         }
     }
     $category = new Category();
     $categories = $category->orderBy('name')->get();
     return view('dashboard/create_event')->with('categories', $categories)->with('event', new Event());
 }
 public function init(Request $request)
 {
     \Illuminate\Support\Facades\Session::flush();
     $session = new Session();
     $session->CreateTime = time();
     $session->save();
     $departments = Department::where('Type', 'execution')->orderBy('ID', 'ASC')->get();
     $retDepartments = [];
     for ($i = 0, $l = count($departments); $i < $l; $i++) {
         $retDepartments[] = $departments[$i]->toObject();
     }
     $categories = Category::orderBy('ID', 'ASC')->get();
     $retCategories = [];
     for ($i = 0, $l = count($categories); $i < $l; $i++) {
         $retCategories[] = $categories[$i]->toObject();
     }
     return view('index', ['sessionId' => $session->id, 'categories' => $retCategories, 'departments' => $retDepartments]);
 }
Example #29
0
 public function overview()
 {
     $newArray = [];
     $Categories = Category::orderBy('category_order', 'asc')->get();
     if (!empty($Categories)) {
         foreach ($Categories as $key => $Category) {
             $newArray[$key] = $Category;
             $newArray[$key]['unread_count'] = $Category['unread_count'] = DB::table('feeds')->join('articles', 'feeds.id', '=', 'articles.feed_id')->where('feeds.category_id', $Category['id'])->where('articles.status', 'unread')->count();
             $newArray[$key]['feeds'] = Category::find($Category['id'])->feeds;
             if (!empty($newArray[$key]['feeds'])) {
                 foreach ($newArray[$key]['feeds'] as $feedkey => $feed) {
                     $newArray[$key]['feeds'][$feedkey]['unread_count'] = DB::table('articles')->where('feed_id', $feed['id'])->where('status', 'unread')->count();
                 }
             }
         }
     }
     return response()->json($newArray);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $categories = Category::orderBy('name', 'ASC')->paginate(8);
     return view('admin.categories.index', compact('categories'));
 }