Support the ongoing development of Laravel.io →
Eloquent Lumen Scheduling

I using eloquent model in lumen scheduler but show error Call to a member function connection() on null but using DB work fine.

<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
use Models\Setting;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [];

    /**
     * Define the application's command schedule.
     *
     * @param \Illuminate\Console\Scheduling\Schedule $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $setting = Setting::find(1);
    }
}

Last updated 2 years ago.

harshalone liked this thread

1

Sign in to participate in this thread!

Eventy

Your banner here too?

HASSANDL hassandl Joined 30 Oct 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.