Skip to content

Instantly share code, notes, and snippets.

View permatis's full-sized avatar

defri permatis

  • Indonesia
View GitHub Profile
@permatis
permatis / getallmodel.md
Last active March 10, 2016 03:48
Create simple helper for get a list all of model in laravel.

How to use

Describe your path where models directory, set your namespace model and adding a prefix if you want (optional).

$modelPath = app_path().'\\Models\\';
$namespace = 'App\Models\\';
dd(getAllModels($modelPath, $namespace));
@permatis
permatis / tagged.php
Created March 14, 2016 09:37
Filtering tags if exists in database records.
<?php
/**
* Filter tag if exists
* @param string $input Get value from input name
* @return array All tags is don't exists
*/
private function tagged($input)
{
$newTags = [];
$tags = explode(',', $input);
@permatis
permatis / AclMiddleware.php
Created March 22, 2016 07:41
Acl with Middleware.
<?php
namespace App\Http\Middleware;
use Closure;
use App\Models\Permission;
class AclMiddleware
{
private $restfull = [