ASSUMING YOU HAVE DOCKER INSTALLED ON YOUR PLATFORM
https://docs.docker.com/engine/installation/
- In the project root create
.dockerfolder anddocker-compose.ymlfile - contents below - Create
.docker/site.conffile with nginx setup - contents below
| <?php | |
| // Freek posted a query today, that drives OhDearApp filters (the app recommended!): | |
| // @link https://twitter.com/freekmurze/status/972299131497713664 | |
| // We can make the query more eloquent, so why don't we use a scope! | |
| // I | |
| // Let's make it really eloquent and get here: | |
| $site->downtimePeriods() |
| <?php | |
| Response::macro('multiFormat', function ($data, $html = '') { | |
| if (request('format') == 'json') { | |
| return $this->json($data); | |
| } | |
| if (request('format') == 'xml') { | |
| if (!is_array($data) && !$data instanceof Arrayable) { /* 400 Bad Request*/ } |
| <?php | |
| $user = User::find($user_id); | |
| $user->branches->load([ | |
| 'roles' => function ($q) use ($user_id) { | |
| $q->where('permissions_users.user_id', $user_id); | |
| }, | |
| 'roles.permissions', | |
| ]); |
| <?php | |
| namespace App\Presenters; | |
| use ArrayAccess; | |
| use Illuminate\Support\Collection; | |
| use Illuminate\Database\Eloquent\Model; | |
| use Illuminate\Contracts\Pagination\Paginator; | |
| class Decorator |
| // controller | |
| $course = Course::with(...)->checkEstablishmentOnView()->excludeArchived()->findOrFail($id); | |
| $view = View::make('some.view')->with('course', $course); | |
| return response()->json(['html' => $view->render()]); | |
| // kahlan spec | |
| it('does some magic and unicorns and all that stuff', function () { | |
| allow(Double::classname(['class' => App\Course::class]))->toReceive('::with')->andReturn($query = Double::instance()); |
| <?php // ~/.config/psysh/config.php | |
| // Anything not Laravel - let's try to autoload something likely to exist | |
| if (!defined('LARAVEL_START')) { | |
| return [ | |
| 'defaultIncludes' => [ | |
| getcwd().'/vendor/autoload.php', | |
| getcwd().'/bootstrap/autoload.php', | |
| ], | |
| ]; |
| <?php | |
| // Easily get route list in tinker | |
| >>> app('RouteList')->setOption('method', 'PUT')->getRoutes() | |
| >>> app('RouteList')->getRoutes()->where('name', 'website.login') | |
| class RouteList extends \Illuminate\Foundation\Console\RouteListCommand | |
| { | |
| /** @var array */ |
ASSUMING YOU HAVE DOCKER INSTALLED ON YOUR PLATFORM
https://docs.docker.com/engine/installation/
.docker folder and docker-compose.yml file - contents below.docker/site.conf file with nginx setup - contents below| <?php | |
| // Not exactly one-liner but.. ;) | |
| // -------------------- | |
| // require: | |
| // illuminate/support | |
| // guzzlehttp/guzzle | |
| $user = 'jarektkaczyk'; | |
| $stars = collect(json_decode((new Guzzlehttp\Client)->get("https://api.github.com/users/{$user}/repos")->getBody(), true)) |