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\Models; | |
use Illuminate\Auth\Authenticatable; | |
use Illuminate\Auth\Passwords\CanResetPassword; | |
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; | |
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; | |
use Illuminate\Database\Eloquent\Model; | |
class User extends Model implements AuthenticatableContract, CanResetPasswordContract | |
{ |
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 | |
/** ...etc */ | |
/** | |
* @param array $fields | |
* @return array | |
*/ | |
protected function data($fields = array()) | |
{ | |
$rules = $this->validator->getRules(); |
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\Controllers; | |
class ExampleResourceController | |
{ | |
protected $repo; | |
protected $model; | |
protected $validator; | |
public function __construct(Repository $repo, Model $model, Validator $validator) | |
{ |
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
@extends('layouts.master') | |
@section('title', 'Products') | |
@section('content') | |
<h2>Products</h2> | |
<table class="table table-striped"> | |
<thead> | |
<tr> | |
<th>ID</th> |
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\Controllers\Admin; | |
use App\Controllers\BaseResourceController; | |
use App\Models\Products; | |
use App\Repositories\Products; | |
use App\Validators\Product as ProductValidator; | |
class ProductsController extends BaseResourceController | |
{ |
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 | |
Route::group(['prefix' => 'admin', 'before' => 'auth.admin', 'namespace' => 'App\Controllers\Admin'], function ($router) { | |
$router->resource('products', 'ProductsController'); | |
}); |
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\Controllers; | |
abstract class BaseResourceController extends BaseController | |
{ | |
protected $repo; | |
protected $model; | |
protected $validator; | |
public function index() | |
{ |
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 | |
// this code is run by the "web" process | |
namespace App\Services; | |
class UserCreator | |
{ | |
public function create($data) | |
{ | |
// ... etc |
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 | |
include __DIR__.'/vendor/autoload.php'; | |
$app = function ($request, $response) { | |
$body = "" . time(); | |
$response->writeHead(200, ['Content-Type' => 'text/plain']); | |
$response->end($body); | |
}; |
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 | |
class Post extends Model | |
{ | |
public static function getRecent() | |
{ /* … etc …*/ } | |
} |