/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { if (auth()->user()->client) { return redirect()->route('admin'); } $farms = FarmCategory::with('farms')->get(); return view('back.registerClientInformation', compact('farms')); }
function editProduct($id) { $brands = Brand::all(); $farms = FarmCategory::with('farms')->get(); $categories = Category::all(); $user = auth()->user(); if ($user->role_id == 1) { $productEdit = Product::find($id); return view('back.productAdminEdit', compact('productEdit', 'offerEdit', 'categories', 'farms', 'brands')); } else { $productEdit = ProductProvider::find($id); $offer = $productEdit->offer()->first(); return view('back.productProviderEdit', compact('productEdit', 'offer', 'categories', 'farms', 'brands')); } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $farmCategories = FarmCategory::with('farms')->paginate(5); return view('back.farms', compact('farmCategories')); }