Skip to content

Instantly share code, notes, and snippets.

Ryan Mortier ryanmortier

Block or report user

Report or block ryanmortier

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@calebporzio
calebporzio / tinker_helper.php
Created Jan 30, 2019
A quick, memorable way to initiate an "artisan tinker" session and play with variables.
View tinker_helper.php
<?php
function tinker(...$args) {
// Because there is no way of knowing what variable names
// the caller of this function used with the php run-time,
// we have to get clever. My solution is to peek at the
// stack trace, open up the file that called "tinker()"
// and parse out any variable names, so I can load
// them in the tinker shell and preserve their names.
@calebporzio
calebporzio / HasUuid.php
Created Jul 5, 2018
A little trait to add to models that will have Uuids
View HasUuid.php
<?php
// Example usage in a model:
class ExampleModel extends Model
{
use HasUuid;
protected $primaryKey = 'uuid';
View AuthServiceProvider.php
<?php
namespace App\Providers;
use App\Permission;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
@djaiss
djaiss / progress_bar_migration_laravel.php
Last active Aug 17, 2019
Laravel: Use progress bars in migrations
View progress_bar_migration_laravel.php
<?php
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\ConsoleOutput;
class DoSomething extends Migration
{
public function up()
{
$output = new ConsoleOutput();
@meigwilym
meigwilym / console.php
Last active Aug 13, 2019
Laravel Create User Command
View console.php
<?php
// routes/console.php
// quickly create an user via the command line
Artisan::command('user:create', function () {
$name = $this->ask('Name?');
$email = $this->ask('Email?');
$pwd = $this->ask('Password?');
// $pwd = $this->secret('Password?'); // or use secret() to hide the password being inputted
\DB::table('users')->insert([
View webpack.mix.js
// ...
let webpack = require("webpack");
mix.webpackConfig({
plugins: [
// Choose the language you want to keep (Ex: "fr")
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /fr/)
]
});
@isuzuki
isuzuki / .php_cs
Last active Jul 26, 2019
Config for PHP-CS-Fixer ver 2 (based on laravel .php_cs https://github.com/laravel/framework/blob/5.4/.php_cs)
View .php_cs
<?php
/**
* Config for PHP-CS-Fixer ver2
*/
$rules = [
'@PSR2' => true,
// addtional rules
View TrimInput.php
<?php
namespace App\Middleware;
use Closure;
class TrimInput
{
public function handle($request, Closure $next)
{
You can’t perform that action at this time.