Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel create command tutorial

<?php

namespace AppConsoleCommands;

use AppModelsUser;
use AppSupportDripEmailer;
use IlluminateConsoleCommand;

class SendEmails extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'email:send {user}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Send drip e-mails to a user';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @param  AppSupportDripEmailer  $drip
     * @return mixed
     */
    public function handle(DripEmailer $drip)
    {
        $drip->send(User::find($this->argument('user')));
    }
}
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #laravel #create #command #tutorial
ADD COMMENT
Topic
Name
7+6 =