Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CompaniesController extends ApiController {
- /**
- * @var CompanyRepository
- */
- private $repository;
- /**
- * CompaniesController constructor.
- * @param CompanyRepository $repository
- */
- public function __construct(CompanyRepository $repository) {
- $this->repository = $repository;
- }
- /**
- * Display a listing of the resource.
- *
- * @return IlluminateHttpResponse
- */
- public function index() {
- return $this->response->collection(
- JWTAuth::parseToken()->authenticate()->companies, new CompanyTransformer
- );
- }
- /**
- * Display the specified resource.
- *
- * @param int $id
- * @return IlluminateHttpResponse
- */
- public function show($id) {
- $item = JWTAuth::parseToken()->authenticate()->companies->find($id);
- if (empty($item))
- throw new NotFoundHttpException();
- return $this->response->item($item, new CompanyTransformer);
- }
- }
Add Comment
Please, Sign In to add comment