View Select2Formatter.php
<?php | |
namespace App\Traits; | |
trait Select2Formatter | |
{ | |
/** | |
* Format your array to the format used by select2 plugin using eloquent | |
* | |
* @param array $data |
View upload.js
const Uppy = require('@uppy/core'); | |
const XHRUpload = require('@uppy/xhr-upload'); | |
const Dashboard = require('@uppy/dashboard'); | |
const PortuguesBR = require('@uppy/locales/lib/pt_BR'); | |
/** | |
* Cria uma instância do plugin Uppy | |
* @param {String|Object} options objeto com algumas opções do plugin | |
*/ | |
window.uploadFiles = (options) => { |
View card.blade.php
<?php | |
<div class="card"> | |
<div class="card-header" | |
@isset($cardHeadingId) | |
id="{{ $cardHeadingId }}" | |
@endisset | |
> | |
<h2 class="mb-0"> | |
<button |
View CloneController.php
<?php namespace App\Http\Controllers; | |
use App\MyModel; | |
class CloneController extends Controller | |
{ | |
/** | |
* Replicate a model and his relationships | |
* | |
* @param $id |
View createDinamicallyElement.js
// check if the attribute key is camelcase | |
const isCamelCase = (str) => { | |
return /[A-Z]/.test(str) | |
} | |
//change the attribute from camelcase to hyphen separator | |
const changeSeparator = (str) => { | |
return str.replace(/([a-zA-Z])(?=[A-Z])/g, '$1-').toLowerCase(); | |
} |
View http-error.js
import { format } from 'url'; | |
import { STATUS_CODES } from 'http'; | |
import uppercamelcase from 'uppercamelcase'; | |
class HTTPError extends Error { | |
constructor(code, message, extras) { | |
super(message || STATUS_CODES[code]); | |
if (arguments.length >= 3 && extras) { | |
Object.assign(this, extras); | |
} |
View .env
DB_CONNECTION=mysql | |
DB_HOST=http://localhost | |
DB_PORT=3306 | |
DB_DATABASE=forge | |
DB_USERNAME=root | |
DB_PASSWORD= | |
DB_CONNECTION2=mysql | |
DB_HOST2=http://localhost | |
DB_PORT2=3306 |
View Handler.php
<?php | |
namespace App\Exceptions; | |
use Exception; | |
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | |
class Handler extends ExceptionHandler | |
{ | |
/** |
View gist:848370c0e133de40b9923b332b481bc3
/* | |
* Ex: | |
* include("http://mysite.com/bookmarklet.css"); | |
* include("http://mysite.com/bookmarklet.js"); | |
*/ | |
let include = ( src, callback ) => { | |
let ext = src.split( /[\#\?]/ )[ 0 ].split( '.' ).pop().toLowerCase(); | |
let inc; | |
if ( ext === 'css' ) { |
NewerOlder