/**
  * Add all the cost for the booking
  * Save belongsTo relationship with Booking model.
  *
  * @param $request [get user input]
  * @param $id      [get booking id]
  */
 public function addBookingDetail($request, $id)
 {
     $booking = $this->booking->getById($id);
     $givenInput = $request->all();
     $data = $this->model->create($givenInput);
     $data->booking()->save($booking);
 }
Exemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     foreach ($request->cost_ids as $cost_id) {
         $cost = Cost::find($cost_id);
         $cost->fiscal_document_id = $request->fiscalDocument_id;
         $cost->save();
     }
     return redirect('/joincosts');
 }
Exemplo n.º 3
0
 /**
  * Get all of the tasks for a given user.
  *
  * @param  User  $user
  * @return Collection
  */
 public function allCosts()
 {
     return Cost::orderBy('created_at', 'desc')->get();
 }
Exemplo n.º 4
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request)
 {
     $cost = Cost::find($request->id);
     $cost->date_mgr = $request->date_mgr;
     $cost->date_acc = $request->date_acc;
     $cost->short_description = $request->short_description;
     $cost->description = $request->description;
     $cost->value = $request->value;
     $cost->supplier_id = $request->supplier_id;
     $cost->currency_id = $request->currency_id;
     $cost->company_id = $request->company_id;
     $cost->marketing_channel_id = $request->marketing_channel_id;
     $cost->category_id = $request->category_id;
     $cost->cost_status_id = $request->cost_status_id;
     $cost->save();
     return redirect('/cost');
 }