extend 命令
插件为您提供了一个支持中文和英文的扩展命令,您可以用命令呼出,命令提供了以下功能
php artisan extend --chinese
中文
php artisan extend
英文
- 创建Rest规范控制器
- 备份数据库
- 命令封禁
- 命令解封
我们提供了个默认视图,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);
}
}
推荐文章: