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
opendb () { | |
[ ! -f .env ] && { echo "No .env file found."; exit 1; } | |
DB_CONNECTION=$(grep DB_CONNECTION .env | grep -v -e '^\s*#' | cut -d '=' -f 2-) | |
DB_HOST=$(grep DB_HOST .env | grep -v -e '^\s*#' | cut -d '=' -f 2-) | |
DB_PORT=$(grep DB_PORT .env | grep -v -e '^\s*#' | cut -d '=' -f 2-) | |
DB_DATABASE=$(grep DB_DATABASE .env | grep -v -e '^\s*#' | cut -d '=' -f 2-) | |
DB_USERNAME=$(grep DB_USERNAME .env | grep -v -e '^\s*#' | cut -d '=' -f 2-) | |
DB_PASSWORD=$(grep DB_PASSWORD .env | grep -v -e '^\s*#' | cut -d '=' -f 2-) |
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 | |
$finder = PhpCsFixer\Finder::create() | |
->exclude('somedir') | |
->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php') | |
->in(__DIR__); | |
return PhpCsFixer\Config::create() | |
->setRules([ | |
'@PSR2' => true, |
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
<!-- Location vendor/spatie/phpunit-watcher/src/Notification.php --> | |
<?php | |
namespace Spatie\PhpUnitWatcher; | |
use Joli\JoliNotif\NotifierFactory; | |
use Joli\JoliNotif\Notification as JoliNotification; | |
class Notification | |
{ |
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
// Add this to the "boot()" method of your "AppServiceProvider" | |
<?php | |
\Illuminate\Database\Eloquent\Builder::macro('search', function ($name, $search) { | |
return $this->where($name, 'LIKE', $search ? '%'.$search.'%' : ''); | |
}); |
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
public static function boot() | |
{ | |
parent::boot(); | |
static::creating(function($model) { | |
$model->slug = str_slug($model->ToBeSlugified); | |
$latestSlug = | |
static::whereRaw("slug = '$model->slug' or slug LIKE '$model->slug-%'") | |
->latest('id') |