Hot File

Make Laravel Artisan Commands

View: 222    Dowload: 0   Comment: 0   Post by: hanhga  
Author: none   Category: Php&mySql   Fields: Other

0 point/0 review File has been tested

Artisan is the command line tool used in Laravel framework. It offers a bunch of useful command that can help you develop application quickly. Apart from Artisan available commands, you can create your own custom commands to improve your workflow.

Introduction

Artisan is the command line tool used in Laravel framework. It offers a bunch of useful command that can help you develop application quickly.  Apart from Artisan available commands, you can create your own custom commands to improve your workflow. Artisan is driven by the powerful Symfony Console component.

If you have not installed laravel check my previous post on

Laravel Artisan Available Commands

Let’s first check the artisan available commands. To check the available artisan command just type.

php artisan

OR

php artisan list
Laravel Framework version 4.1.9
Usage:
[options] command [arguments]
Options:
--help           -h Display this help message.
--quiet          -q Do not output any message.
--verbose        -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
--version        -V Display this application version.
--ansi              Force ANSI output.
--no-ansi           Disable ANSI output.
--no-interaction -n Do not ask any interactive question.
--env               The environment the command should run under.
Available commands:
<strong>changes</strong>                     Display the framework change list
<strong>clear-compiled</strong>              Remove the compiled class file
<strong>down</strong>                        Put the application into maintenance mode
<strong>dump-autoload</strong>               Regenerate framework autoload files
<strong>env</strong>                         Display the current framework environment
<strong>help</strong>                        Displays help for a command
<strong>list</strong>                        Lists commands
<strong>migrate</strong>                     Run the database migrations
<strong>optimize</strong>                    Optimize the framework for better performance
<strong>routes</strong>                      List all registered routes
<strong>serve</strong>        Serve the application on the PHP development server
<strong>tail</strong>                        Tail a log file on a remote server
<strong>tinker</strong>              Interact with your application
<strong>up</strong>                Bring the application out of maintenance mode
<strong>workbench</strong>          Create a new package workbench
<strong>asset</strong>
asset:publish               Publish a package's assets to the public directory
<strong>auth</strong>
auth:clear-reminders        Flush expired reminders.
auth:reminders              Create a migration for the password reminders table
auth:reminders-controller   Create a stub password reminder controller
<strong>cache</strong>
cache:clear                 Flush the application cache
<strong>command</strong>
command:make                Create a new Artisan command
<strong>config</strong>
config:publish              Publish a package's configuration to the application
<strong>controller</strong>
controller:make             Create a new resourceful controller
<strong>db</strong>
db:seed                     Seed the database with records
<strong>key</strong>
key:generate                Set the application key
<strong>migrate</strong>
migrate:install             Create the migration repository
migrate:make                Create a new migration file
migrate:refresh             Reset and re-run all migrations
migrate:reset               Rollback all database migrations
migrate:rollback            Rollback the last database migration
<strong>queue</strong>
queue:failed                List all of the failed queue jobs
queue:failed-table          Create a migration for the failed queue jobs database table
queue:flush                 Flush all of the failed queue jobs
queue:forget                Delete a failed queue job
queue:listen                Listen to a given queue
queue:retry                 Retry a failed queue job
queue:subscribe             Subscribe a URL to an Iron.io push queue
queue:work                  Process the next job on a queue
<strong>session</strong>
session:table               Create a migration for the session database table
<strong>view</strong>
view:publish                Publish a package's views to the application

Apart from using the available commands you can create your own commands.

How to Create New Artisan Custom Command

To create a new php artisan command. Type following

 php artisan command:make firstcommand

firstcommand is the name of command.

To define this command go to

/app/commands/firstcommand.php

Open this file and define command functionality in fire method. So whenever this command is executed fire method is called.

use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class firstcommand extends Command {
/**
* The console command name.
*
* @var string
*/
protected $name = 'command:name';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
//
}
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return array(
array('example', InputArgument::REQUIRED, 'An example argument.'),
);
}
/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return array(
array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
);
}
}

To make sure artisan know the newly created command Add the following line to yourapp/start/artisan.php file.

Conclusion

This is just an overview of available Artisan commands and how to create custom commands. In my next posts, i’ll explain how to create applications in Laravel framework and how artisan command help you to develop application quickly.

Make Laravel Artisan Commands

Make Laravel Artisan Commands Posted on 12-10-2016  Artisan is the command line tool used in Laravel framework. It offers a bunch of useful command that can help you develop application quickly. Apart from Artisan available commands, you can create your own custom commands to improve your workflow. 5/10 222

Comment:

To comment you must be logged in members.

Files with category

  • How to Picking the Brains of Your Customers with Microsoft’s Text Analytics

    View: 2948    Download: 0   Comment: 0   Author: none  

    How to Picking the Brains of Your Customers with Microsoft’s Text Analytics

    Category: Php&mySql
    Fields: Other

    5/1 review
    With the explosion of machine learning services in recent years, it has become easier than ever for developers to create “smart apps”. In this article, I’ll introduce you to Microsoft’s offering for providing machine-learning capabilities to apps.

  • How to MySqli Tutorial PHP MySqli Extension

    View: 246    Download: 0   Comment: 0   Author: none  

    How to MySqli Tutorial PHP MySqli Extension

    Category: Php&mySql
    Fields: Other

    0/0 review
    PHP provides three api to connect mysql Database.

  • Make Laravel Artisan Commands

    View: 222    Download: 0   Comment: 0   Author: none  

    Make Laravel Artisan Commands

    Category: Php&mySql
    Fields: Other

    0/0 review
    Artisan is the command line tool used in Laravel framework. It offers a bunch of useful command that can help you develop application quickly. Apart from Artisan available commands, you can create your own custom commands to improve your workflow.

  • Check if a Number is a Power of 2

    View: 202    Download: 0   Comment: 0   Author: none  

    Check if a Number is a Power of 2

    Category: Php&mySql
    Fields: Other

    2.25/2 review
    How to check if a number is a power of 2. To understand this question, let’s take some example.

  • Concatenate columns in MySql

    View: 261    Download: 0   Comment: 0   Author: none  

    Concatenate columns in MySql

    Category: Php&mySql
    Fields: Other

    0/1 review
    Artisan is the command line tool used in Laravel framework. It offers a bunch of useful command that can help you develop application quickly. Apart from Artisan available commands, you can create your own custom commands to improve your workflow

  • How to Query NULL Value in MySql

    View: 193    Download: 0   Comment: 0   Author: none  

    How to Query NULL Value in MySql

    Category: Php&mySql
    Fields: Other

    5/1 review
    Misunderstanding NULL is common mistake beginners do while writing MySql query. While quering in MySql they compare column name with NULL. In MySql NULL is nothing or in simple word it isUnknown Value so if you use comparison operator for NULL values...

  • How to Abstract Class in PHP

    View: 226    Download: 0   Comment: 0   Author: none  

    How to Abstract Class in PHP

    Category: Php&mySql
    Fields: Other

    0/0 review
    What is an abstract class in PHP and when to use an abstract class in your application. In this tutorial, we’ll learn about abstract class and their implementation.

  • Use Enums in Rails for Mapped Values

    View: 221    Download: 0   Comment: 0   Author: none  

    Use Enums in Rails for Mapped Values

    Category: Php&mySql
    Fields: Other

    5/1 review
    When I worked in a call center, we used to mark cases with different statuses. This allowed upper management to get a handle on where cases stood, what the bottlenecks were and flow of calls. Thankfully it has been a long time since I worked in a...

 
Newsletter Email

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd