Git Product home page Git Product logo

artisan-extended's Introduction

Laravel Artisan Extended

Installation

composer require cleaniquecoders/artisan-extended

Register Service Provider

Open up config/app.php and register CleaniqueCoders\ArtisanExtended\ArtisanExtendedServiceProvider::class, in providers key.

Publishing Reusable Components and Layouts

Run following command to publish reusable components:

php artisan vendor:publish --tag=artisan-extended-views

p/s: Scaffold / Resourceful views require reusable components, hence you need to publish the artisan-extended-views.

Important Notes

On production, only php artisan clear:cache available for use, other than that if your application running on local or staging, all the Artisan Extended commands available for you on artisan console.

Available Commands

Create a New Scaffold

You may create single or multiple Model at one time.

php artisan make:scaffold Post

OR

php artisan make:scaffold Post Like Video Photo Reaction

p/s: Please take note that, for now you still need to update the model $fillable property, ModelFactory.php and model's migration scripts.

Clear All Caches

php artisan clear:cache

Clear All Caches and Serve the Application

php artisan clear:serve

In case you need to run at different port:

php artisan clear:serve --port=9000

Create a New Route

php artisan make:route RouteName

Options available:

  1. -a - Create a new route for API
  2. -p - Set prefix for the route
  3. -m - Set middleware for the route. Each middleware separated by comma(,)
  4. -r - Create a new resourceful controller

Create an API Route

php artisan make:route -a Post

Create an API Route with Version

php artisan make:route -a -p v1 Post

Create an API Route with Version and Middlewares

php artisan make:route -a -p v1 -m auth:auth,jwt Post

Create a new View

Generate a view extending default layout, app.

php artisan make:view welcome

Generate a new admin's dashboard with layouts of admin.

php artisan make:view admin.dashboard -p admin

Generate a resourceful view, by passing a -r option and ommit the specific blade files.

php artisan make:view users -r

This command will create a directory named users in resources/views. There will be:

  1. index.blade.php,
  2. show.blade.php and
  3. form.blade.php.

You may want to create a resourceful controller by running php artisan make:resourceful UserController.

Create Event & Listener

php artisan make:eventlistener Post

Secure your Cookies

This command only for the new project only, as this command will change the default value of the cookie name to random string and set encrypt to true. It's recommended to change your application's cookie name and encrypt it.

php artisan secure:cookie

artisan-extended's People

Contributors

nasrulhazim avatar

Stargazers

 avatar  avatar

Watchers

 avatar

artisan-extended's Issues

Using Transformer for Routes

Using Transformer for routes (web/api), so that only one class will be created in app/Routes directory.

Let say we have

app\
    \Routes
         User.php
    \Transformers
        API.php
        Web.php

In routes/web.php, to call a route class will be like

\App\Routes\User::routes()->transform(new App\Route\Transformer\Web());

And routes/api.php, to call a route class will be like

\App\Routes\User::routes()->transform(new App\Route\Transformer\API());

This the rough ideas of the implementation.

not support laravel 5.4

Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: don't install laravel/framework v5.4.14

Make View

Create a new resourceful / empty views based on given model name and parent name

php artisan make:view -p layouts.app Post

This will generate a new directory in resources/views named posts and will have the following files and structures.

resources
    \views
        \layouts
            app.blade.php
        \posts
            index.blade.php
            show.blade.php
            form.blade.php

All the views will use reusable components which later can be modify by using php artisan vendor:publish --tag=artisan-extended-view.

resources
    \views
        \components
            \forms
                base.blade.php
                input.blade.php
                textarea.blade.php
            list.blade.php
            actions.blade.php

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.