...
"require": {
"vendor/package": "1.3.2", // exactly 1.3.2 (exact)
// >, <, >=, <= | specify upper / lower bounds
"vendor/package": ">=1.3.2", // anything above or equal to 1.3.2
"vendor/package": "<1.3.2", // anything below 1.3.2
// * | wildcard
This file contains 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 | |
// Refactor the following functions using your new skills from 99-bottles. | |
// Sorry about the lack of tests - bonus points if you write tests to get started. | |
function getStartDate() { | |
return preg_match("/^\d\d\d\d-\d\d-\d\d$/", $_GET['dStartDate']) ? $_GET['dStartDate'] : date("Y-m-d", time() - 60 * 60 * 24 * 7); | |
} | |
function getEndDate() { |
This file contains 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 | |
// Before: | |
function getStartDate() { | |
return preg_match("/^\d\d\d\d-\d\d-\d\d$/", $_GET['dStartDate']) ? $_GET['dStartDate'] : date("Y-m-d", time() - 60 * 60 * 24 * 7); | |
} | |
function getEndDate() { | |
return preg_match("/^\d\d\d\d-\d\d-\d\d$/", $_GET['dEndDate']) ? $_GET['dEndDate'] : date("Y-m-d"); |
This file contains 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 Tests; | |
use Illuminate\Translation\Translator; | |
use Laravel\BrowserKitTesting\TestCase as BaseTestCase; | |
abstract class TestCase extends BaseTestCase | |
{ | |
use CreatesApplication; |
This file contains 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\Providers; | |
use Illuminate\Support\ServiceProvider; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
public function boot() | |
{ |
This file contains 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 | |
// Until SessionGuard Macros get pulled into Laravel core from a PR: | |
// Remove this when Laravel 5.4.18 is released. | |
$this->app->config->set('auth.guards.hack', [ | |
'driver' => 'modified-session', | |
'provider' => 'users', | |
]); |
This file contains 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 | |
// Define in some ServiceProvider | |
Browser::macro('waitForReload', function () { | |
$this->script("window.duskPageIsStale = {}"); | |
return $this->waitUntil("return typeof window.duskPageIsStale === 'undefined';"); | |
}); | |
// Usage: |
This file contains 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 | |
/** | |
* Automatically alias Laravel Model's to their base classname. | |
* Ex: "App\Models\User" now can just be accessed by "User" | |
*/ | |
if (! function_exists('aliasModels')) { | |
function aliasModels() { | |
$finder = new \Symfony\Component\Finder\Finder(); | |
$finder->files()->name('*.php')->in(base_path().'/app'); |
This file contains 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
{ | |
"name": "laravel/laravel", | |
"description": "The Laravel Framework.", | |
"keywords": ["framework", "laravel"], | |
"license": "MIT", | |
"type": "project", | |
"require": { | |
"php": ">=5.6.4", | |
"laravel/framework": "5.4.x-dev", | |
"laravel/tinker": "~1.0" |
This file contains 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; | |
use Illuminate\Database\Eloquent\Model; | |
class [Insert Name Here] extends Model | |
{ | |
protected $guarded = []; |
OlderNewer