Skip to content

Instantly share code, notes, and snippets.

View phillipsharring's full-sized avatar
💭
Open for work!

Phil Harrington (he/him) phillipsharring

💭
Open for work!
View GitHub Profile
@phillipsharring
phillipsharring / LearnerProfileController.php
Last active January 5, 2017 17:34
A function swapping back and forth between collections and arrays that I'm sure could be refactored #laravel #collections
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Auth;
use App\Services\ReportService;
use App\Models\User;
class LearnerProfileController extends Controller
{
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"require": {

#Middleware in Laravel 5

Middleware is a powerful feature of Laravel 5. In this talk, we'll briefly cover what middleware is, it's place in the Laravel lifecycle, and how to create it. Then we'll look at some real-world, in-production use cases that demonstrate the appropriate use of middleware to examine incoming requests, and situations where you might modify the out-going response headers or body content. Finally, you'll learn some use-cases where not to use middleware, and how to test it. Phillip is a web developer with 16 years of experience currently building solutions with Laravel for Cisco Systems, Inc.'s Learning@Cisco team.

@phillipsharring
phillipsharring / Kernel.php
Last active October 9, 2023 13:11 — forked from kkiernan/MySqlDump.php
Laravel Artisan command to perform MySQL Dump using database connection information in the .env file. Posted 2016 Jan. Unsupported. Forked from https://gist.github.com/kkiernan/bdd0954d0149b89c372a
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
@phillipsharring
phillipsharring / RouteServiceProvider.php
Last active February 13, 2018 12:37
Database Driven Routes in Laravel 5.1
<?php
// ...
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
<?php
// app/providers/AppServiceProvider.php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider {
Bcrypt Passwords with PHP 5.5
@phillipsharring
phillipsharring / email-valid.php
Last active August 29, 2015 14:05
Email Validation Function
<?php
/**
* emailValid
* Email Validation Function
* I take an email as a string and test it against 2 regular expressions.
*
* @author Regexp Author unknown
* @author Phillip Harrington <philsown@gmail.com>
* @param string $email
* @return bool $valid
@phillipsharring
phillipsharring / MyCustomValidator.php
Last active December 22, 2015 11:49
Zend Framework 2 Form Attaching a custom validator to an element that allows nulls.
<?php
namespace Application\Validator;
use Zend\Validator\AbstractValidator;
class MyCustomValidator extends AbstractValidator
{
const CONDITIONAL_EMPTY = 'conditionally_empty';
const SOMETHING_BAD = 'something_bad';