/**
  * Handle the command.
  *
  * @param  CreateConcreteCommand  $command
  * @return void
  */
 public function handle(CreateConcreteCommand $command)
 {
     $command = Concrete::create(['title' => $command->title, 'description' => $command->description, 'extra_description' => $command->extra_description, 'amount' => $command->amount, 'category_id' => $command->category_id]);
     if (!empty($command)) {
         return $command;
     }
     return false;
 }
Esempio n. 2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $concrete = Concrete::whereId($id)->first();
     if (!empty($concrete)) {
         return $this->saveResponse($concrete->delete());
     }
     return $this->saveResponse(false);
 }
 /**
  * Handle the command.
  *
  * @param  UpdateConcreteCommand  $command
  * @return void
  */
 public function handle(UpdateConcreteCommand $command)
 {
     $concrete = Concrete::whereId($command->id)->first();
     if (!empty($concrete)) {
         $concrete->title = $command->title;
         $concrete->description = $command->description;
         $concrete->extra_description = $command->extra_description;
         $concrete->amount = $command->amount;
         $concrete->category_id = $command->category_id;
         if ($concrete->update()) {
             return $concrete;
         }
     }
     return false;
 }