当前位置:网站首页>Write console script by laravel
Write console script by laravel
2022-04-23 11:18:00 【Scholar and】
One :
app\Console\Commands Create a script file in the directory TestConsole.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Base\CommonPoolMethod;
// Connecting to the database can introduce database related classes
class TestConsole extends Command
{
use CommonPoolMethod;
/** * The name and signature of the console command. * update:artisan Lower command group , You can use 【php artisan -v】 or 【php artisan list】 see * test_function : Explain the function of the command ( at will ) * Full command 【php artisan update:test_function】 * @var string */
protected $signature = 'update:test_function';
/** * The console command description. * * @var string */
protected $description = " Update test method ";
/** * Create a new command instance. * * @return void */
public function __construct()
{
parent::__construct();
}
public function handle()
{
// Scripting methods
}
}
Two :laravel Execute... In the root directory artisan command 【php artisan update:test_function】
notes : Error in execution of order 【SQLSTATE[HY000] [2002] No such file or directory 】
reason : Not found mysql.sock file
solve :
1: open MySQL Management tools , perform sql sentence 【show variables like ‘%sock%’】, Get a directory 【/Applications/MAMP/tmp/mysql/mysql.sock】
2: find ./config/database.php Medium unix_socket, modify 【‘unix_socket’ => ‘/Applications/MAMP/tmp/mysql/mysql.sock’】
perhaps
.env Corresponding DB_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock
版权声明
本文为[Scholar and]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231116051441.html
边栏推荐
猜你喜欢

系统编程之高级文件IO(十三)——IO多路复用-select

Using Baidu PaddlePaddle EasyDL to accomplish specified target recognition

Excel · VBA custom function to obtain multiple cell values

vm设置静态虚拟机

Résumé de la relation entre GPU, cuda et cudnn

laravel编写Console脚本

MySQL Router重装后重新连接集群进行引导出现的——此主机中之前已配置过的问题

一道有趣的阿里面试题

C语言之结构体(进阶篇)

After the MySQL router is reinstalled, it reconnects to the cluster for boot - a problem that has been configured in this host before
随机推荐
Alarm scene recognition
闹钟场景识别
Using El popconfirm and El backtop does not take effect
Implementation of partition table of existing data table by MySQL
Get things technology network optimization - CDN resource request Optimization Practice
Pytorch neural network trainer
R-Drop:更强大的Dropout正则方法
Mba-day5 Mathematics - application problems - engineering problems
MySQL interview questions explain how to set hash index
妊娠箱和分娩箱的区别
卷积层和池化层总结
About the three commonly used auxiliary classes of JUC
Implementation of inserting millions of data into MySQL database in 10 seconds
详解MySQL中timestamp和datetime时区问题导致做DTS遇到的坑
分享两个实用的shell脚本
Promise详解
MySQL Router重装后重新连接集群进行引导出现的——此主机中之前已配置过的问题
web三大组件(Servlet,Filter,Listener)
Mba-day6 logic - hypothetical reasoning exercises
初探 Lambda Powertools TypeScript