Skip to content

Instantly share code, notes, and snippets.

View genesis_public_key
04e5eb0b048e8e2016383f7d699167a67e07a0aca4cb04fa365f7bd5e8175a4857f9844ef8f3085be40302b3c62cca85a873d5f8e81d78774cf119b12cc69e64d7
@armababy
armababy / *.js
Created Sep 20, 2017
Fileuploads via jquery
View *.js
// Somewhere
(function ($) {
$.fn.serializefiles = function () {
var obj = $(this);
/* ADD FILE TO PARAM AJAX */
var formData = new FormData();
$.each($(obj).find("input[type='file']"), function (i, tag) {
$.each($(tag)[0].files, function (i, file) {
formData.append(tag.name, file);
});
View module.json
{
"name": "UserProfile",
"alias": "userprofile",
"description": "",
"version": "v0.1",
"keywords": [],
"active": 1,
"order": 1,
"providers": [
"Modules\\UserProfile\\Providers\\UserProfileServiceProvider",
View EventServiceProvider.php
<?php namespace Modules\UserProfile\Providers;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Modules\User\Events\UserWasUpdated;
use Modules\UserProfile\Events\Handlers\EventHandler;
class EventServiceProvider extends ServiceProvider
{
protected $listen = [
View EventHandler.php
<?php namespace Modules\UserProfile\Events\Handlers;
use Modules\User\Events\UserWasUpdated;
class EventHandler {
public function handle(UserWasUpdated $event)
{
dd($event);
}
View <entity>Controller.php
<?php
use Modules\Media\Http\Controllers\Api\MediaController;
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @param Route $route
* @param MediaController $media
* @return Response
View file-link.blade.php
@armababy
armababy / MediaController.php
Last active Feb 17, 2016
MediaControlller for thumbs
View MediaController.php
<?php namespace Modules\<module_name>\Http\Controllers\Api;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Response;
use Illuminate\Routing\Controller;
use Modules\Media\Repositories\FileRepository;
use Modules\Media\Image\Imagy;
class MediaController extends Controller
{
View Index source
<script class="-kint-js">(function(){if("undefined"===typeof kintInitialized){kintInitialized=1;var e=[],f=-1,g=function(a){var b=window.getSelection(),c=document.createRange();c.selectNodeContents(a);b.removeAllRanges();b.addRange(c)},h=function(a){Array.prototype.slice.call(document.querySelectorAll(".kint nav, .kint-tabs>li:not(.kint-active-tab)"),0).forEach(a)},k=function(a,b){if(!a.classList)return!1;"undefined"===typeof b&&(b="kint-show");return a.classList.contains(b)},l=function(a,b){"undefined"===typeof b&&(b="kint-show");a.classList.add(b)},
m=function(a,b){"undefined"===typeof b&&(b="kint-show");a.classList.remove(b)},n=function(a){do a=a.nextElementSibling;while("dd"!==a.nodeName.toLowerCase());return a},q=function(a,b){var c=n(a);"undefined"===typeof b&&(b=k(a));b?m(a):l(a);1===c.childNodes.length&&(c=c.childNodes[0].childNodes[0])&&k(c,"kint-parent")&&q(c,b)},r=function(a,b){var c=n(a).getElementsByClassName("kint-parent"),d=c.length;for("undefined"===typeof b&&(b=k(a));d--;)q(c[d],b);q(a,b)},s=