Skip to content

Instantly share code, notes, and snippets.

@kJamesy
kJamesy / TruncateTables.php
Last active September 28, 2017 08:41
Laravel 5.5 Command to Truncate DB Tables. php artisan db:truncate
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class TruncateSeededTables extends Command
{
/**
View::composer(
[
'layouts.base',
],
function($view) use ($variable) {
$view->with(compact('variable'));
});
@kJamesy
kJamesy / ErrorHandlers.php
Last active January 27, 2016 12:05
A simple class to be called inside Laravel's App/Exceptions/Handler.php to handle token mismatch exceptions gracefully. PS: when redirecting, exclude bad token from old input
<?php namespace App\Helpers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Response;
class ErrorHandlers
{
/**
* Quickly define a general token mismatch error message
* @return string