Skip to content

Instantly share code, notes, and snippets.

Matt Wells mattwells

Block or report user

Report or block mattwells

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
@mattwells
mattwells / Orphan Finder.sql
Last active Aug 29, 2015
Fast query to find orphaned rows
View Orphan Finder.sql
SELECT `id`, COUNT(`id`) as `count`
FROM (
SELECT `id`
FROM `items`
UNION ALL
SELECT `id`
FROM `related`
) AS `union`
GROUP BY `id`
HAVING `count` = 1;
@mattwells
mattwells / User.php
Created Feb 12, 2015
Laravel 5 Eloquent Casts
View User.php
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class User extends Model {
// ...
/**
* The attributes that should be casted to native types.
@mattwells
mattwells / route.php
Created Apr 14, 2014
Nested Routes in Laravel 4
View route.php
<?php
Route::group(['prefix' => 'forum/{fId}'], function()
{
Route::resource('topic/{tId}', 'TopicController');
});
Route::resource('forum', 'ForumController');
class TopicController extends BaseController
{
You can’t perform that action at this time.