Skip to content

Instantly share code, notes, and snippets.


Martin Bean martinbean

View GitHub Profile
View gist:458399eb793bcc67373ebbd639b4a224
### Keybase proof
I hereby claim:
* I am martinbean on github.
* I am martinbean ( on keybase.
* I have a public key ASB2_ZA3DkCT9MjQuO8huSLkj8dOOxr8Cyy_bMrG3HAVJQo
To claim this, I am signing this object:
martinbean / CartPage.php
Created Mar 15, 2019
Laravel Dusk example test
View CartPage.php
namespace Tests\Browser\Pages;
use Laravel\Dusk\Browser;
class CartPage extends Page
* {@inheritDoc}
martinbean / LogNameHandler.php
Last active Mar 15, 2019
Mapping jobs to handler classes in Lumen
View LogNameHandler.php
namespace App\Handlers\Jobs;
use App\Jobs\LogNameJob;
use Illuminate\Support\Facades\Log;
class LogNameHandler
public function __construct()
View styles.css
p:last-of-type::after {
content: "\0020 \220E"
martinbean / component.js
Created Nov 10, 2018
Promise-based Vue.js confirmation dialog mixin
View component.js
import confirm from './confirm';
export default {
mixins: [
methods: {
onDelete() {
this.confirm('Are you sure you wish to delete this item?').then(() => {
// Delete item
martinbean / webpack.mix.js
Created May 17, 2018
Vendor library extraction in Laravel Mix
View webpack.mix.js
let mix = require('laravel-mix');
mix.sass('resources/assets/sass/app.scss', 'public/css')
.js('resources/assets/js/app.js', 'public/js')
.js('resources/assets/js/channel-admin.js', 'public/js')
.js('resources/assets/js/video.js', 'public/js')
.extract(['jquery', 'bootstrap'])
.options({ processCssUrls: false })
View gist:d2889eef2bc4affddcd6a2386b44dd2a
vendor/bin/phpunit --printer="PHPUnit\TextUI\ResultPrinter"
martinbean / ArticleController.php
Created Mar 26, 2018
Using Laravel’s Responsable interface to create view models
View ArticleController.php
namespace App\Http\Controllers;
use App\Article;
use App\Http\Views\ArticleIndex;
class ArticleController extends Controller
public function index()
martinbean / AppServiceProvider.php
Last active Mar 1, 2018
Disable Bugsnag in certain environments
View AppServiceProvider.php
namespace App\Providers;
use Bugsnag\BugsnagLaravel\Facades\Bugsnag;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
public function boot()
martinbean / test.php
Created Feb 6, 2018
Throw a validation exception with a plain array of errors
View test.php
use Illuminate\Validation\ValidationException;
if ($coupon->cannotBeRedeemed()) {
throw ValidationException::withMessages([
'coupon' => [
'The coupon code is invalid.',
You can’t perform that action at this time.