Skip to content

Instantly share code, notes, and snippets.

@ChadTaljaardt
Created February 16, 2017 02:56
Show Gist options
  • Save ChadTaljaardt/7d5a4e22f9c023f8599dcf1f2288c38c to your computer and use it in GitHub Desktop.
Save ChadTaljaardt/7d5a4e22f9c023f8599dcf1f2288c38c to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Route::middleware('auth:api')->get('plates/unique', function (Request $request) {
return $request->user()->plates->unique('plate');
});
Route::middleware('auth:api')->get('plates/24hours', function (Request $request) {
return $request->user()->plates->days(2)->unique('plate')->count();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment