Laravel 5.3 App \ Console \ Commdans \ AwesomeCommand | Uncaught ReflectionException

时间:2017-01-20 19:35:42

标签: php laravel-5.3

我知道,有很多关于ReflectionException的问题。

是的,我试过了:composer dump-autoload
我也做了:artisan admin:clear
admin:清楚这样做:

public function handle()
{
    Artisan::call('cache:clear');
    Artisan::call('config:clear');
    Artisan::call('view:clear');
    Artisan::call('route:clear');
}

我做了一个类的复制/粘贴,以确保它们是相同的。

当我评论新命令时,一切正常。所以,问题在于这个新命令。

现在代码:

<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        Commands\SendUlogs::class,
        Commands\ClientPriority::class,
        Commands\SmsBasic::class,
        Commands\AdminClear::class,
        Commands\CheckIps::class,
        Commdans\AdminYesterday::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('oneaction:priority')
                 ->hourly();
        $schedule->command('ips:verify')
                 ->dailyAt('8:00');
        $schedule->command('ips:verify')
                 ->dailyAt('10:00');
    }

    /**
     * Register the Closure based commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        require base_path('routes/console.php');
    }
}

就像我之前说的那样,当我这样做时:

protected $commands = [
    Commands\SendUlogs::class,
    Commands\ClientPriority::class,
    Commands\SmsBasic::class,
    Commands\AdminClear::class,
    Commands\CheckIps::class,
    //Commdans\AdminYesterday::class,
];

一切正常。现在新命令的新代码:     

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Carbon;
use Messaging;
use App\CompUltime;
use App\CompElite;
use App\CompSimple;
use App\CompSubvsbank;
use App\CompAmortissement;
use App\CompBonifie;
use App\Client;
use App\Ip;
use App\User;

class AdminYesterday extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'admin:yesterday';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Send result of yesterday by sms.';

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

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $start = Carbon::yesterday()->startOfDay();
        $end = $start->copy()->endOfDay();
        $countSimple = CompSimple::where('created_at', '>=', $start)->where('created_at', '<=', $end)->count();
        $countElite = CompElite::where('created_at', '>=', $start)->where('created_at', '<=', $end)->count();
        $countUltime = CompUltime::where('created_at', '>=', $start)->where('created_at', '<=', $end)->count();
        $countBonifie = CompBonifie::where('created_at', '>=', $start)->where('created_at', '<=', $end)->count();
        $countAmortissement = CompAmortissement::where('created_at', '>=', $start)->where('created_at', '<=', $end)->count();
        $countSubvsbank = CompSubvsbank::where('created_at', '>=', $start)->where('created_at', '<=', $end)->count();
        $clients = Client::where('created_at', '>=', $start)->where('created_at', '<=', $end)->count();

        $comps = $countSimple+$countElite+$countUltime+$countBonifie+$countAmortissement+$countSubvsbank;

        $admins = User::where('is_admin', 1)->get();
        foreach ($admins as $admin) {
            Messaging::msg(printView(view('sms.admin.register')->with('contact', $contact)))->to('1'.$admin->username)->sendMessage();
        }
    }
}

我试图删除句柄,看看是不是因为代码中的错误。我没有工作。

那么,我错过了什么?

0 个答案:

没有答案