From 0ee38e98532a9daf7ba08ab65b7f73d6505e0aea Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Fri, 24 Aug 2018 13:17:32 +0200 Subject: Began API for posts --- api/Posts/Console/AddPostCommand.php | 59 ++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 api/Posts/Console/AddPostCommand.php (limited to 'api/Posts/Console') diff --git a/api/Posts/Console/AddPostCommand.php b/api/Posts/Console/AddPostCommand.php new file mode 100644 index 0000000..977afb6 --- /dev/null +++ b/api/Posts/Console/AddPostCommand.php @@ -0,0 +1,59 @@ +postRepository = $postRepository; + } + + /** + * Execute the console command. + * + * @return mixed + */ + public function handle() + { + $post = $this->postRepository->create([ + 'name' => $this->argument('name'), + 'email' => $this->argument('email'), + 'password' => $this->argument('password') + ]); + + $this->info(sprintf('A post was created with ID %s', $post->id)); + } +} \ No newline at end of file -- cgit v1.2.3