1day 安装laravel-debug,创建模型,创建migration,1对多创建$texts->texts_recorder()->create,发送邮件,队列,定时任务

周日

安装laravel-debugar

 

php artisan clear-compiled

php artisan ide-helper:generate

php artisan optimize 

 

 

 

用户创建视图

php artisan make:auth

 

创建一个有资源的和模型的控制器

php artisan make:controller TextController  -r --model=Texts

 

创建migrate文件

php artisan make:migration create_text_table --create=texts

 

类型要一致

$table->unsignedInteger('auth_id');

$table->foreign('auth_id')->references('id')->on('users')->onDelete('cascade');

 

 

 

TextController.php

Texts.php

 php artisan route:list --name text

Route::resource('text','TextController');

 

 

直接注入模型

 

Route::any('submit/{texts}','TextController@submit');

 

use App\Texts;

控制器public function submit(Texts $texts)

 

 

这个对应的表是text_records

 

 

 

1对多的

创建

$texts->texts_recorder()->create(

['rule_detail' => 1, 'now_rule_id' => 1, 'status' => '2']

);

 

2

如就按照上述配置会报:

Expected response code 250 but got code "553", with message "553 Mail from must equal authorized user
"

 

这是因为有些邮件服务器要求from和username必须一致,163邮箱就是这样。

为避免这个问题,我们可以将发件代码中的setFrom设置去掉,或者在param.php(或param-local.php)中配置supportEmail参数:

'supportEmail' => 'zhong_mail_test@163.com'

这样就能成功发送邮件了。

 

3

php artisan queue:listen --timeout=5 --tries=2

php artisan queue:failed-table

php artisan migrate

 

 

 

定时任务

crontab -e

* * * * *  php /Users/gu/keiweila/keiweila/artisan  schedule:run 

 

 

 

  • python
  • cobol
  • ABAP
  • C++
  • Java

 

posted @ 2017-12-18 23:27  克维拉  阅读(123)  评论(0)    收藏  举报