I am trying to make my task appear on the notifications part. I have set the task scheduler already (Windows 10) and I have this function inside a class:
public static function forecastModal($store_id = NULL)
{
$inventory_forecasts = DB::table('restock_inventories', $store_id)
->join('product', function($join){
$join->on('restock_inventories.product_id', '=', 'product.id');
})
->where('product.store_id', $store_id)
->where('product.sku_type', '!=', 'Old Inactive')
->where('restock_inventories.days_of_supply', '<', 14)
// ->distinct()
->select('product.sku', 'restock_inventories.days_of_supply')
->groupBy('product.sku')
->paginate(10);
$data = [
'restock_inventories' => $inventory_forecasts
];
Log::info("Matt");
return response()->json($inventory_forecasts);
event(new TaskSchedulesEvents('Days of Supply', 'Days of Supply', $store_id, Auth::id(), 'inventory-forecast-v2/'.$store_id));
}
I tried putting the event inside a controller function(for the navbar) and it was working. The notification "Days of Supply" appeared. But when I put it back inside the Class under the folder "Common" it's not working again.