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();
}
}