Skip to content

Instantly share code, notes, and snippets.

@imliam
imliam / query_string.php
Last active November 9, 2019 15:52
Laravel 5 - URL Query String Helper
<?php
/*
|--------------------------------------------------------------------------
| Laravel 5 - URL Query String Helper
|--------------------------------------------------------------------------
|
| A helper function to take a URL string then quickly and easily add query
| string parameters to it, or change existing ones.
|
| url_queries(['order' => 'desc', 'page' => 2],
@imliam
imliam / pagination.blade.php
Last active November 26, 2018 15:23
Laravel 5 - Bootstrap 4 Pagination
<?php
/*
|--------------------------------------------------------------------------
| Laravel 5, Bootstrap 4 Pagination
|--------------------------------------------------------------------------
|
| A partial view to handle pagination for collections in Laravel's query
| builder or Eloquent ORM, styled with Bootstrap 4.
|
| The pagination displays like the following, where * denotes the current
@imliam
imliam / trigger.sql
Created March 8, 2017 16:08
MySQL - At least one column must have a value
/*
|--------------------------------------------------------------------------
| At least one column must have a value
|--------------------------------------------------------------------------
|
| This is a simple pair of triggers for MySQL databases that will disallow
| a row to be inserted into a table unless at least one of two predefined
| columns has a value set.
|
*/
@imliam
imliam / web.php
Created March 8, 2017 16:01
Laravel 5 - Routing an unknown number of sub-levels
<?php
/*
|--------------------------------------------------------------------------
| Routing an unknown number of sub-levels
|--------------------------------------------------------------------------
|
| This is how you can route an unknown number of sub-levels and pass them
| to the same controller. For example, the following URLs will go through
| the same route:
|