asantibanez / laravel-subscribable-notifications Goto Github PK
View Code? Open in Web Editor NEWLaravel Subscribable Notifications
License: MIT License
Laravel Subscribable Notifications
License: MIT License
When a user that is subscribed to at least one notification is soft deleted, notifications are still trying to be sent to them but are failing because the contact info no longer exists (soft deleted).
We need to scope the query that get's the list of users to send the notification to.
Fix add $with = ['user'];
class NotificationSubscription extends Model
{
use HasFactory;
protected $guarded = [];
protected $with = ['user'];
public function user()
{
return $this->belongsTo(NotificationSubscriptionManager::userModel());
}
@asantibanez Will this package get support for Laravel 9? If I submitted a PR, will you merge it?
Dispatch method send notification to all subscribed user for specific order, But it should be sent to only subscriber user of that order.
For example:
OrderCreated notification subscribers 3 users, like user_id: 5, 15, 26
Order owner user_id is 26
So OrderCreated::dispatch($order) only should send to 26, Not for all 5, 15 and 26.
config:
'subscribable_notifications' => [
OrderCreated::class,
OrderEdited::class,
],
OrderCreated Notification:
public static function subscribableNotificationType(): string
{
return 'Order-Created';
}
Controller function:
public function sent_email()
{
$order = Order::find(Session::get('order_id'));
$order->setStatusConfirmed();
// $order->user->notify(new OrderCreated($order));
OrderCreated::dispatch($order);
return response()->json(['status' => 'success']);
}
Great package for notification subscription. Are you extending this package to enable notifications of a particular model events.
Need to be able to delay the sending of a Notification, and would like it to follow the Laravel api for such use case.
$delay = now()->addMinutes(10);
InvoicePaidNotification::dispatch($invoice)->delay($delay);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.