Skip to content

Instantly share code, notes, and snippets.

@antonioribeiro
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save antonioribeiro/c10958178f7dc9ea8cb8 to your computer and use it in GitHub Desktop.
Save antonioribeiro/c10958178f7dc9ea8cb8 to your computer and use it in GitHub Desktop.

###Form Request (Validation)

class Update extends FormRequest {

	public function rules()
	{
		return [
			... whatever
		];
	}

}

###Controller

	public function update(UpdateRequest $request)
	{
		$this->execute(UpdateEventCommand::class, $request->all());
		
		$this->flash->message('paragraphs.event-updated');

		return back();
	}

###Command

class UpdateEventCommand extends SelfHandlingCommand {

	public  $id,
			$user,
			$client_id,
			$office_room_id,
			$title,
			$description,
			$start,
			$end,
			$updated_start,
			$updated_end,
			$full,
			$color;

	public function handle(EventRepository $repository)
	{
		return $repository->updateEvent($this->getPublicProperties());
	}

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment