Skip to content

Instantly share code, notes, and snippets.

@calebporzio
calebporzio / error_blade_directive.php
Created March 28, 2019 20:34
A little Blade directive to make working with validation errors a bit nicer.
<?php
// Usage:
// Before
@if ($errors->has('email'))
<span>{{ $errors->first('email') }}</span>
@endif
// After:
@snipe
snipe / AppServiceProvider.php
Last active February 13, 2020 11:16
Validate email array in Laravel 5.2 wth custom validator
<?php
/**
* This service provider handles a few custom validation rules.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v3.0
*/
namespace App\Providers;
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git
@yajra
yajra / ajax-datatables-expired-session.js
Last active June 30, 2022 20:34
Laravel 5.x solution to redirect AJAX expired session to login page and disable DataTables error prompt
/**
* Requirements:
* - jQuery (http://jquery.com/)
* - DataTables (http://datatables.net/)
* - BootboxJS (http://bootboxjs.com/)
* ---------------------------------------------------------------------------
* Credits to https://gist.github.com/flackend/9517696
* ---------------------------------------------------------------------------
* This monitors all AJAX calls that have an error response. If a user's
* session has expired, then the system will return a 401 status,
@mikedfunk
mikedfunk / file_append.php
Created October 4, 2013 21:38
Laravel file append
<?php
File::append(app_path().'/queue.txt', 'nice'.PHP_EOL);
@JeffreyWay
JeffreyWay / laravel.js
Last active April 6, 2024 20:12
Want to send a DELETE request when outside of a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. (Requires jQuery, but doesn't have to.) To use, import script, and create a link with the `data-method="DELETE"` attribute.
/*
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-confirm="Are you sure?">
*/
(function() {