Skip to content

silverreve23/customartisan.bash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Custom artisan for create file patterns

How to install

  • Step 1. Add downloaded or cloned project to your project root folder.
  • Step 2. Go to downloaded or cloned project folder.
  • Step 3. Open terminal and run command make.

Example

Before:

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateFlightsTable extends Migration
{
    /**
    * Run the migrations.
    *
    * @return void
    */
    public function up()
    {
        Schema::create('flights', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('airline');
            $table->timestamps();
        });
    }

    /**
    * Reverse the migrations.
    *
    * @return void
    */
    public function down()
    {
        Schema::drop('flights');
    }
}

After:

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

#-------------------------------------------------------------------------------
# @class CreateFlightsTable
# Class handle migrate
#-------------------------------------------------------------------------------
class CreateFlightsTable extends Migration{

    public $tableName = 'flights';

    #---------------------------------------------------------------------------
    # @method create
    # @access private
    # @params (object) Blueprint
    # @return callback
    # Metod before create table structure
    #---------------------------------------------------------------------------
    private function create(){
        return function(Blueprint $table){
            $table->increments('id');
            $table->string('name');
            $table->string('airline');
            $table->timestamps();
        };
    }

    #---------------------------------------------------------------------------
    # @method up
    # @access public
    # @params void
    # @return void
    # Metod create table
    #---------------------------------------------------------------------------
    public function up(){
        Schema::create(
            $this->tableName,
            $this->create()
        );
    }

    #---------------------------------------------------------------------------
    # @method down
    # @access public
    # @params void
    # @return void
    # Metod drop table
    #---------------------------------------------------------------------------
    public function down(){
        Schema::dropIfExists(
            $this->tableName
        );
    }

}

About

Custom artisan for create file patterns

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published