Giter VIP home page Giter VIP logo

traits's Introduction

Ezamux Core

Set of Method usefull for laravel project

TRAITS

Rest

If you use the ressource method on your laravel routes :

<?php

    Route::resource('users', 'UserController');`

You can use this simple Trait on your Controllers and define the static $model variables :

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Ezamux\Traits\Rest;

class UserController extends Controller
{
    use Rest;

    public static $model = "App\User";
}

Or you can pick separately Api or Web Rest's Method you want

use Ezamux\Traits\Rest\Api;

use Ezamux\Traits\Rest\Api\Destroy;
use Ezamux\Traits\Rest\Api\Index;
use Ezamux\Traits\Rest\Api\Show;
use Ezamux\Traits\Rest\Api\Store;
use Ezamux\Traits\Rest\Api\Update;

use Ezamux\Traits\Rest\Web;

use Ezamux\Traits\Rest\Web\Create;
use Ezamux\Traits\Rest\Web\Edit;

The Rest\Web\traits method return the add.blade.php file based on model name directory ( kebab-case )

Model User : resources/view/user/add.blade.php Model MobilHome : resources/view/mobil-home/add.blade.php

return view

RESOLVER

DETERMINATOR

insert during migration columns : created_by, updated_by, deleted_by

with the the helper

$table->determinator($deletor = true);

And auto-fill it with the Auth::user() during creating, updating and deleting method

add relation

<?php

Use Ezamux/Traits/Determinator;

class Post {
    use Determinator;
}

$post = Post::find(1);
$post->creator();
$post->updator();
$post->deletor();

the deleted_by column and deletor relation are available automatically, to disable ( no SoftDetele Model ) :

$table->determinator(false);

PROVIDERS

Blueprint

Add the $table->determinator($determinator = true) macro for Blueprint

Blade

Add the @route() and @routein() blade statement

{{-- Route::currentRouteName() = home --}}
@route('home')
YES
@endroute

@routenot('admin')
NO
@endroutenot

grouped route ( dot prefix )
{{-- Route::currentRouteName() = admin.users --}}
@routein('home')
NO
@endroutein

@routenotin('admin')
YES
@endroutenotin

All directive can have multiple parameters :

@route('home', 'admin', 'rgpd')

Pretty usefull for navigation highlighting

traits's People

Contributors

ezamlinux avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.