Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

diadal's avatar

No query results for model

Am getting this error Any idea how to fix this?


php artisan ScheduleMsg:send

In Builder.php line 329:
                                             
  No query results for model [App\Updatacc]  
                                             

My Command class


<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Carbon\Carbon;
use App\Updatacc;
use App\Notifications\UpdateNotification;
use DB;

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

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Send Schedule Messages Updatacc';

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

    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $dds = DB::table("messages")->where('timestamp' ,'!=',null)->where('status',5)->get();

        foreach( $dds as $dd ) {
           

            $updatacc =  Updatacc::where('id', $dd->updatacc_id)->first();
                
              $tbody = $dd->body;
              $title = $dd->title;
           
 
              $updatacc->notify(new UpdateNotification($id,$title));

                         
          
      }

      
  }


My App\Updatacc

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use App\User;
use App\Message;
use App\Notification;
use Carbon\Carbon;


//use Illuminate\Database\Eloquent\Model;

class Updatacc extends Model
{
    use Notifiable;


   public function user()
  {

    return $this->belongsTo(User::class);
  }

   public function message()
  {

    return $this->hasMany(Message::class);
  }

  public function scopeFilter($query, $filters)
  {
    

  }

  public static function archives()
  {
    return static::selectRaw('year(created_at) year, monthname(created_at) month, count(*) published')

    ->groupBy('year', 'month')

    ->orderByRaw('min(created_at) desc')

    ->get()

    ->toArray();

  }

}


0 likes
5 replies
jdunsmore's avatar

Updateacc is looking for a model named "Updateacc"

In your App\Updateacc file it is calling it

class Pushuser extends Model

Change Pushuser to Updateacc

Or vice versa - should sort the problem

Not entirely sure how there is discrepancies in the first place..

diadal's avatar

Updated But same issue

class Updateacc extends Model

It works fine in controller but I need to setup schedule system for this function

jdunsmore's avatar

@diadal

Sorry I misread your code - you have

updatacc

I thought it was supposed to be

updateacc

Try fixing that typo and see how you get on

diadal's avatar

so far no luck this only var URL and I need to add Updatacc id to the URL before it work i:e example.com/anything/{Updataccid} this work but example.com/anything without {Updataccid} will not work it give same error msg

No query results for model [App\ Updatacc] 

diadal's avatar
diadal
OP
Best Answer
Level 2

I solve this issue by converting my code to URL and use Curl for schedule

Please or to participate in this conversation.