Skip to content

Instantly share code, notes, and snippets.

View massimoselvi's full-sized avatar

Massimo Selvi massimoselvi

View GitHub Profile
<?php
namespace app\support\stubs;
/**
* Fix relations
* @see https://github.com/laravel/framework/pull/6576
*
*/
use Illuminate\Database\Eloquent\Relations\HasOne;
https://laracasts.com/search?q=polymorphic
https://laracasts.com/search?q=relationships
http://codeplanet.io/laravel-model-relationships-pt-1
{if env('APP_DEBUG')}
<a href="javascript:$('div.debug.varName-{$key}').toggleClass('hidden');void(0);">debug varName-{$key}</a>
<div class="debug varName-{$key} hidden">
<pre>
varName: {$varName|dump}
</pre>
</div>
{/if}
@massimoselvi
massimoselvi / gisttools.js
Created September 21, 2016 09:29
refresh icon test
<a href="javascript:alert('refresh?');void(0);" class="m-0 p-l-5 p-r-5 p-t-10 p-b-10"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></a>
@massimoselvi
massimoselvi / debugbar-format-date.php
Created October 5, 2016 09:25
Laravel: get the date with format (MySQL timestamp)
Debugbar::addMessage(date("Y-m-d H:i:s"), __FILE__);
@massimoselvi
massimoselvi / gisttools.js
Created October 5, 2016 09:27
debug output Carbon date
$today = new Carbon\Carbon();
Debugbar::addMessage($today, __FILE__);

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@massimoselvi
massimoselvi / SassMeister-input.scss
Created November 24, 2016 20:14 — forked from davidkpiano/SassMeister-input.scss
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
$scotch-color-key: 'base' !default;
$scotch-colors: (
'primary': (
'base': #8e3329,
@massimoselvi
massimoselvi / SparkRoleMiddleware.md
Created December 8, 2016 23:39 — forked from dillinghamio/SparkRoleMiddleware.md
Team Role Middleware For Laravel Spark

Team Role Middleware For Laravel Spark

Makes it simple to use Spark's role feature on routes

Route::group(['middleware'=>'role:owner'], function(){
    // owners only
});

Route::group(['middleware'=>'role:member'], function(){