Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel Job:Type error: Too few arguments to function App\Jobs\AnalyseActivitiesQuality::__construct() #9

Closed
FupingQiu opened this issue Oct 15, 2018 · 1 comment

Comments

@FupingQiu
Copy link
Owner

Type error: Too few arguments to function App\Jobs\AnalyseActivitiesQuality::__construct()

[2018-09-14 16:38:14] local.ERROR: Type error: Too few arguments to function App\Jobs\AnalyseActivitiesQuality::__construct(), 0 passed in D:\laragon\www\OKRsWalking\app\Console\Kernel.php on line 30 and exactly 3 expected {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Type error: Too few arguments to function App\Jobs\AnalyseActivitiesQuality::__construct(), 0 passed in D:\laragon\www\OKRsWalking\app\Console\Kernel.php on line 30 and exactly 3 expected at D:\laragon\www\OKRsWalking\app\Jobs\AnalyseActivitiesQuality.php:43)
[stacktrace]

@FupingQiu
Copy link
Owner Author

FupingQiu commented Oct 15, 2018

__construct() 用途: 创建实例,用于参数的传输
可以为空,不需要传参数的时候。

__handle() 用途: 用于执行任务,逻辑处理;包括初始化实例
需要创建实例,用于调用实例,进行类的调用,如__handle(User $user),此时可以进行$user->first()等操作。laravel 5.6 document 中:handle 方法在任务被处理的时候调用,注意我们可以在任务的 handle 方法中进行依赖注入。Laravel 服务容器会自动注入这些依赖。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant