extend 命令

未匹配的标注
本文档最新版为 1.6.X,旧版本可能放弃维护,推荐阅读最新版!

插件为您提供了一个支持中文和英文的扩展命令,您可以用命令呼出,命令提供了以下功能

php artisan extend --chinese中文

php artisan extend英文

  • 创建Rest规范控制器
  • 备份数据库
  • 命令封禁
  • 命令解封

Laravel

Laravel

我们提供了个默认视图,views/helpers/error.balde.php,请根据您的页面协调更改样式。

提示:由于业务不同,工具将不提供发布通知的 Artisan 命令

您如果需要一个可使用的Artisan命令来进行业务通知可以参考以下示例,根据相关业务进行调整:

<?php

namespace App\Console\Commands;

use App\Notifications\BusinessDayNotification;
use App\Services\NoticeService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Notification;

class BusinessNotifyCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'business:notify {text=:  通知内容} {--key= :  机器人key,填写则使用,不填写则读取env配置} ';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '通知店铺情况';

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


    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->output->progressStart(1);
        $this->output->title('正在通知,请稍后!');
        //如果有指定key就用指定key,如果没有就从目前的企业微信机器人中读取key
        $key=$this->option('key');
        $text = $this->argument('text');
        //读取传入参数,传入hour则通知每小时   传入day则为每日
        if (!$key) {
            $key=env("DINGTALK_ROBOT");
        }
        Notification::route('dingtalk_robot', $key)
            ->notify(new BusinessDayNotification($text));

        $message='机器人通知完毕';

        //输出本次结果。
        $this->output->progressFinish();
        $this->comment($message);
    }
}

本文章首发在 LearnKu.com 网站上。

上一篇 下一篇
chowjiawei
《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 0
发起讨论 只看当前版本


暂无话题~