/** * Store a newly created resource in storage. * * @return Response */ public function store() { $rules = array('morning_production' => 'integer', 'later_production' => 'integer', 'morning_production' => 'integer', 'price_production' => 'required|integer'); $this->validate($request, $rules); $m_p = MilkProduction::findOrFail($id); $m_p->morning_production = $request->morning_production; $m_p->later_production = $request->later_production; $m_p->total_production = $request->morning_production + $request->later_production; $m_p->price_production = ($request->morning_production + $request->later_production) * $request->price_production; $mp->save(); $animals = Animal::where('idUser', Auth::id())->get(); //dd($animals); return view('animals.milk_production', compact('animals')); }
public function meat_productions(Request $request) { $meat_productions = new MilkProduction(); $meat_productions->idUser = Auth::id(); $meat_productions->idAnimal = Animal::where('id', $request->name)->pluck('id'); $meat_productions->idAnimal = Weight::where('id', $request->id)->pluck('id'); //ultimo peso $meat_productions->dateWeight = Input::get('dateWeight'); $meat_productions->save(); }