/** * Get a list of categories * * @return static */ public function getList() { $categories = $this->category->all(); $response = $categories->map(function ($item) { return ["id" => $item->id, "name" => $item->name]; }); return $response; }
/** * Display a listing of the resource. * * @return Response */ public function index(Category $category) { $categoriesObj = $category->all(); $categoriesArr = $category->getCategoriesArr($categoriesObj); $parentChildArr = $this->categoryPAndCObj->getHierarchy(); return view('categories.index', compact('categoriesObj', 'parentChildArr', 'categoriesArr')); }
public function edit($id) { $category = Category::all(); $product = Product::find($id); $imagepivot = $product->image_product()->where('product_id', $id)->get()->toArray(); return view('admin.products.edit', compact('product', 'category', 'imagepivot')); }
public function all() { $businesses = Business::all(); $categories = Category::all(); $page = "Toutes les entreprises"; return view('businesses', compact('businesses', 'page', 'categories')); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show(Category $category) { // $blogs = $category->blogs()->paginate(5); $categories = Category::all(); return view('categories.show', compact('blogs', 'category', 'categories')); }
/** * Index page * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index() { $productsCount = Product::all()->count(); $categoriesCount = Category::all()->count(); $usersCount = User::all()->count(); return view('manage.index', compact('productsCount', 'categoriesCount', 'usersCount')); }
public function edit($id) { $post = Post::whereId($id)->FirstOrFail(); $categories = Category::all(); $selectedCategories = $post->categories->lists('id')->toArray(); return view('backend.posts.edit', compact('post', 'categories', 'selectedCategories')); }
public function __construct() { // injecter du code dans une vue, $view <-> au template View::composer('partials.main_menu', function ($view) { $view->with('categories', Category::all()); }); }
public static function getAllFromCache() { $categories = Cache::rememberForever('categories', function () { return Category::all(); }); return $categories; }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (Category::all()->count() > 0) { return $next($request); } return redirect()->route('courses.index')->withErrors(['message' => 'No existen categorías registradas.']); }
public function edit($id) { $product = Product::find($id); $tags = Tag::lists('name', 'id'); $categories = Category::all(); return view('admin.edit', compact('product', 'tags', 'categories')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $category = Category::all(); return $category; // return dd($products); //remove later //return response()->json(['categories'=>$categories]); }
public function edit($id) { $displays = $displayss = Display::all(); $categorys = $categoryss = Category::all(); $article = Article::find($id); return view('admin.articles.edit', ['article' => $article, "categorys" => $categorys, "categoryss" => $categoryss, "displays" => $displays, "displayss" => $displayss]); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $pageTitle = 'Add New Article'; // Administrator if (Auth::user()->hasRole(['administrator'])) { $categories = Category::all(); } // Department Manager if (Auth::user()->hasRole(['department_manager'])) { $department = Auth::user()->departments->first(); $categories = Category::where('department_id', '=', $department->id)->get(); } // Category Manager if (Auth::user()->hasRole(['category_manager'])) { $categories = Category::where('manager', '=', Auth::user()->id); } // Article Manager // Who can write for all categories of department which is allocated. // Currently, article managers are separately with category managers if (Auth::user()->hasRole(['article_manager'])) { $department = Auth::user()->departments->first(); $categories = Category::where('department_id', '=', $department->id)->get(); } return view('home.articles.create', compact('pageTitle', 'categories')); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $formats = Format::all(); $categories = Category::all(); $output = array('formats' => $formats, 'categories' => $categories); return view('user.addBook', compact('output')); }
public function __construct() { view::composer('partials.nav', function ($view) { $categories = Category::all(); $view->with(compact('categories')); }); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $article = Article::findOrFail($id); $categories = Category::all(); $tags = Tag::lists('name', 'id'); return view('articles.admin.edit', compact('article', 'categories', 'tags')); }
public function index() { /*Se recibe todos los registros de la tabla categorias y se guardan en la variable $categories*/ $categories = Category::all(); //dd($categories); return view('admin.category.index', compact('categories')); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $communitys = Community::all(); $cities = City::all(); $categories = Category::all(); return view('posts.create', ['communitys' => $communitys, 'categories' => $categories, 'cities' => $cities]); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $order = Order::findOrFail($id); $categories = Category::all(); $products = Product::where('category_id', '=', $categories[0]->id)->get(); return view('order.show', compact('order', 'categories', 'products')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $pageTitle = 'All Categories'; $originalCategories = Category::all(); // 需要修改为登陆用户可以查看的Categories,而不是全部 $i = 0; $categories = array(); // 如果一个分类都没有添加,将不会进入foreach循环,故此处需要提前申明并赋值一个$categories foreach ($originalCategories as $originalCategory) { $department = Department::find($originalCategory->department_id); $parent_category = $originalCategory->parent_category ? Category::find($originalCategory->parent_category)->display_name : '--'; $isManageable = 0; if (Auth::user()->hasRole(['administrator'])) { $isManageable = 1; } if (Auth::user()->hasRole(['department_manager']) && $department->id == Auth::user()->departments->first()->id) { $isManageable = 1; } if (Auth::user()->hasRole(['category_manager']) && $department->manager == Auth::user()->id) { $isManageable = 1; } $categories[$i] = array('number' => $i + 1, 'id' => $originalCategory->id, 'name' => $originalCategory->name, 'display_name' => $originalCategory->display_name, 'description' => $originalCategory->description, 'manager' => $originalCategory->manager, 'department' => $department->display_name, 'parent_category' => $parent_category, 'is_manageable' => $isManageable); $i++; } return view('home.categories.index', compact('pageTitle', 'categories')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $categories = Category::all(); //dd($categories); $dish = Dish::find($id); return view('dishes.edit')->with(['dish' => $dish, 'categories' => $categories]); }
/** * Display a listing of the resource. * * @return Response */ public function index() { // $blogs = Blog::latest('published_at')->published()->paginate(5); $categories = Category::all(); return view('blogs.index', compact('blogs', 'categories')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $location = new Location(); $location = $location->findId($id)->first(); $category = Category::all(); return view('admin.update', compact('location', 'category')); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $categories = Category::all(); $category = Category::findOrFail($id); $posts = Post::where('category_id', $category->id)->orderBy('created_at', 'DESC')->paginate(4); return view('categories.show')->with('categories', $categories)->with('posts', $posts)->with('title', $category->title); }
public function index($username) { $articles = Article::where('user_id', '=', auth()->user()->id)->orderBy('created_at', 'desc')->get(); $categories = Category::all(); $tags = Tag::all(); return view('articles.new')->with(['articles' => $articles, 'categories' => $categories, 'tags' => $tags]); }
/** * Show the application welcome screen to the user. * * @return Response */ public function index() { $categoriesObj = Category::all(); $categoriesArr = Category::getCategoriesArr($categoriesObj); $parentChildArr = CategoryParentAndChildren::getHierarchy(); return view('welcome', compact('categoriesObj', 'parentChildArr', 'categoriesArr')); }
public function edit($id) { $request = Request::with(['equipment', 'area', 'location', 'category', 'uploads', 'approvers', 'status', 'actions' => function ($query) { $query->orderBy('created_at', 'desc'); }, 'actions.submitted', 'comments.author' => function ($query) { $query->orderBy('created_at', 'asc'); }])->find($id); if (is_null($request)) { return view('security.not-found'); } $data['request'] = $request; $data['areas'] = Area::all(['id', 'name']); $data['organizations'] = Organization::all(); $data['categories'] = Category::all(['id', 'name']); $data['locations'] = Location::all(['id', 'name']); $data['approvers'] = Approval::getRecent($id); $data['hasApproved'] = Approval::hasApproved($id)->exists(); if ($request->Status->name == 'Approved') { return view('request.view', $data); } if ($request->submitted_by != Auth::User()->id && !Auth::User()->hasRole(['administrator', 'approver'])) { return view('security.401'); } return view('request.edit', $data); }
public function __construct() { View::composer('layouts.master', function ($view) { $categories = Category::all(); $view->with(compact('categories')); }); }
public function edit($id) { $cities = City::all(); $categories = Category::all(); $post = $this->postRepository->getById($id); return view('posts.edit', compact('post', 'cities', 'categories')); }