Skip to content

Instantly share code, notes, and snippets.

Derek MacDonald derekmd

  • Canada
View GitHub Profile
derekmd / Optional.php
Last active Mar 22, 2018
Laravel global helper function `optional()`
View Optional.php
namespace App\Support;
class Optional
* The target being transformed.
* Use _ prefix to avoid namespace conflict on __get()
derekmd / Data_dot_data_has.php
Last active Jun 12, 2017
data_dot() and data_has() helper function compliments to PHP framework Laravel. Supports stdClass, Collection, or Arrayable objects along with standard PHP arrays. The intention is to allow nested wildcard pattern matching on structured data.
View Data_dot_data_has.php
// app/helpers.php
// Why don't you let us order files, Gist?
use Illuminate\Support\Arr;
if (!function_exists('data_dot')) {
* Flatten a multi-dimensional object with dots.
You can’t perform that action at this time.