Skip to content

Instantly share code, notes, and snippets.

View jpmurray's full-sized avatar
🏠
Working from home

Jean-Philippe Murray jpmurray

🏠
Working from home
View GitHub Profile
@jpmurray
jpmurray / @roles.md
Last active May 17, 2020 14:54 — forked from dillinghamio/@role.md
@roles Blade Directive For Laravel Spark

@roles Blade Directive For Laravel Spark

Assumes you're using teams

Add this to the boot() method of your AppServiceProvider

\Blade::directive('role', function($role) {

 $user = auth()->user();
@jpmurray
jpmurray / laravel.js
Created January 8, 2016 01:50 — forked from soufianeEL/laravel.js
You use Laravel 5 and you want to send a DELETE request without creating a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. To use, import script, and create a link with the `data-method="DELETE"` and `data-token="{{csrf_token()}}"` attributes.
/*
Exemples :
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}">
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}" data-confirm="Are you sure?">
*/
(function() {