Skip to content

Instantly share code, notes, and snippets.

@developerdino
Last active September 6, 2017 10:12
Show Gist options
  • Select an option

  • Save developerdino/dfe3ff0f91e1e6d48df9205eb11412c9 to your computer and use it in GitHub Desktop.

Select an option

Save developerdino/dfe3ff0f91e1e6d48df9205eb11412c9 to your computer and use it in GitHub Desktop.
Using Laravel 5.5 Resources to create your own {JSON:API} formatted API - Medium Gists
<?php
namespace App\Http\Controllers;
use App\Article;
class ArticleController extends Controller
{
/**
* Display the specified resource.
*
* @param \App\Article $article
* @return \Illuminate\Http\Response
*/
public function show(Article $article)
{
return $article->toArray();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment