Created
March 14, 2018 01:42
-
-
Save jsdecena/d2ac32da50a769fb0f47fd230d7a33a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Api; | |
use App\Articles\Repositories\Interfaces\ArticleRepositoryInterface; | |
use App\Articles\Requests\CreateArticleRequest; | |
use App\Http\Controllers\Controller; | |
class ArticlesApiController extends Controller | |
{ | |
private $articleRepo; | |
public function __construct(ArticleRepositoryInterface $articleRepository) | |
{ | |
$this->articleRepo = $articleRepository; | |
} | |
/** | |
* Store all the data request in the database | |
* | |
* @param CreateArticleRequest $request | |
* @return \Illuminate\Http\JsonResponse | |
*/ | |
public function store(CreateArticleRequest $request) | |
{ | |
$article = $this->articleRepo->create($request->all()); | |
return response()->json($article, 201); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment