Exemplo n.º 1
0
 /**
  * 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'));
 }
Exemplo n.º 2
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create(Request $request)
 {
     $validator = Validator::make($request->all(), ['farmCategory' => 'required']);
     if ($validator->fails()) {
         return redirect()->back()->withInput()->withErrors($validator);
     }
     FarmCategory::create(['name' => $request->get('farmCategory')]);
     return redirect()->back();
 }
Exemplo n.º 3
0
 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'));
     }
 }