Skip to content

Instantly share code, notes, and snippets.

View developerdino's full-sized avatar

Dean Tedesco developerdino

  • Verified International @verifedit
  • Melbourne, Australia
  • 07:15 (UTC +10:00)
  • X @developerdino
View GitHub Profile
@developerdino
developerdino / handy_git_commands.sh
Last active May 9, 2017 23:55
Handy GIT Commands
# remove all tags from origin that end in digits (/[0-9]*)
# remove --dry-run to actually do the deletions
git ls-remote --tags | grep -o 'refs/tags/.*/[0-9]*' |sort -r |xargs git push --dry-run --delete origin
# sync all remote tags with your local repo so you don't push them all back up to the remote
git fetch --prune origin '+refs/tags/*:refs/tags/*'
@developerdino
developerdino / article-collection.json
Last active September 6, 2017 09:33
Using Laravel 5.5 Resources to create your own {JSON:API} formatted API - Medium Gists
{
"links": {
"self": "http://example.com/articles",
"first": "http://example.com/articles?page=1",
"last": "http://example.com/articles?page=2",
"prev": null,
"next": "http://example.com/articles?page=2"
},
"data": [
{
@developerdino
developerdino / ArticleController.php
Last active September 6, 2017 10:12
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.
@developerdino
developerdino / standard-article-response.json
Created September 6, 2017 10:14
Using Laravel 5.5 Resources to create your own {JSON:API} formatted API - Medium Gists
{
"id": 1,
"title": "JSON API paints my bikeshed!",
}
@developerdino
developerdino / jsonapi-org-example.json
Created September 6, 2017 10:15
Using Laravel 5.5 Resources to create your own {JSON:API} formatted API - Medium Gists
{
"links": {
"self": "http://example.com/articles",
"next": "http://example.com/articles?page[offset]=2",
"last": "http://example.com/articles?page[offset]=10"
},
"data": [{
"type": "articles",
"id": "1",
"attributes": {
@developerdino
developerdino / CreatePeopleTable.php
Last active September 7, 2017 01:20
Using Laravel 5.5 Resources to create your own {JSON:API} formatted API - Medium Gists
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePeopleTable extends Migration
{
/**
* Run the migrations.
@developerdino
developerdino / CreateArticleTable.php
Last active September 7, 2017 01:21
Using Laravel 5.5 Resources to create your own {JSON:API} formatted API - Medium Gists
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateArticlesTable extends Migration
{
/**
* Run the migrations.
@developerdino
developerdino / CreateCommentsTable.php
Last active September 7, 2017 01:22
Using Laravel 5.5 Resources to create your own {JSON:API} formatted API - Medium Gists
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCommentsTable extends Migration
{
/**
* Run the migrations.
@developerdino
developerdino / article-item.json
Last active September 7, 2017 01:24
Using Laravel 5.5 Resources to create your own {JSON:API} formatted API - Medium Gists
{
"type": "articles",
"id": "1",
"attributes": {
"title": "JSON API paints my bikeshed!"
},
"links": {
"self": "http://example.com/api/articles/1"
}
}
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\Resource;
class ArticleResource extends Resource
{
/**
* Transform the resource into an array.