feat: send WhatsApp notification on production order completed
This commit is contained in:
1 parent
5b2a46c753
commit
a1f6e765e1
2 files changed
+36
No files matched your search
@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
|
||||
use App\Models\Item;
|
||||
use App\Models\ProductionCost;
|
||||
use App\Models\ProductionOrder;
|
||||
use App\Notifications\Production\ProductionOrderCompletedNotification;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ProductionOrderController extends Controller
|
||||
@@ -89,6 +90,12 @@ class ProductionOrderController extends Controller
|
||||
'completion_date' => now(),
|
||||
]);
|
||||
|
||||
$productionManagers = \App\Models\User::role('Production Manager')->whereNotNull('whatsapp_number')->get();
|
||||
\Illuminate\Support\Facades\Notification::send(
|
||||
$productionManagers,
|
||||
new ProductionOrderCompletedNotification($productionOrder)
|
||||
);
|
||||
|
||||
return redirect()->back()->with('success', 'Production order marked as completed.');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user