Esempio n. 1
0
 public function store(BatchRequest $request)
 {
     $input = $request->all();
     // Create new Batch and add date/times
     $batch = new Batch($input);
     $batch->created_at = Carbon::now();
     $batch->updated_at = Carbon::now();
     // Add the authenticated user as the batch creator
     \Auth::user()->batches()->save($batch);
     return redirect('batches');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  BatchRequest  $request
  * @param  string        $uuid
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update(BatchRequest $request, $uuid)
 {
     $batch = $this->batch->locate($uuid);
     $batch->name = $request->input('name', $batch->name);
     $batch->description = $request->input('description', $batch->description);
     $batch->lifetime = $request->input('lifetime', $batch->lifetime);
     if ($batch->save()) {
         flash()->success('Success!', 'Successfully updated folder.');
         return redirect()->route('batch.show', [$batch->uuid]);
     } else {
         flash()->error('Error!', 'There was an error updating this folder. Please try again.');
         return redirect()->route('batch.edit', [$batch->uuui]);
     }
 }