how to make the view link on Notifications show/trigger the modal and show the data through modal?

I have this Notification where after customer orders speicifc product from the customer-side it notifies the admin using notification , just like the notification on the demo-filament.php. However I disabled the editing of the orders. So what I want to achieve instead is to show the ordered data through modal using ViewAction?? is this possible? btw im not using filament for customer-side, only on admin side TIA 🙂
25 Replies
awcodes
awcodes16mo ago
I think it would be better to redirect to a view page. I don’t think it’s good to leave them on the create page so they can’t try to creat the same record again.
Chrysippus
ChrysippusOP16mo ago
ohh, my bad. my description is wrong, The notification part is from the admin, User -> creates order -> notifies -> admin I have updated it, sorry.
awcodes
awcodes16mo ago
Right and normally they would get redirected to the edit page for the record since it’s already been created. I’m saying that you should just redirect them to a view page instead. No modal needed.
Chrysippus
ChrysippusOP16mo ago
yeah but isnt that would confuse the admin if for instance there's 12 notifications in different time and the admin decided to click/view oldest which then redirects him to Orders/viewpage it will make him filter the first just to what user's ordered. but if what you're saying is i can modify the url so the table will be filtered automatically and show the data of the ordered item that came from notification. I think that's good, if its possible
awcodes
awcodes16mo ago
Is this a simple resource? I’m not following you.
Chrysippus
ChrysippusOP16mo ago
sry idk what simple resource means. ohh i get it now, no.. it is not I just removed the create module of my OrderResource for now
awcodes
awcodes16mo ago
Ok. So, there’s no reason to send them back to a table view if you’re going to show them the record they created anyway. So just send them to a view page after it’s created instead of the edit page. I’m mean they can only create one record at a time anyway.
Chrysippus
ChrysippusOP16mo ago
ohh, sorry, i am not using filament for my customer's end basically I just use filament for admin its an small ecommerce app. basically if customer creates an order I want to send notification to the admin-side which then will be seen on notifications modal and it will have a view link but since i disabled the
Pages\CreateOrder
Pages\EditOrder
Pages\CreateOrder
Pages\EditOrder
on the admin it will not be possible right? since view link returns /{record}/edit. Is there any other way to view the specific order base on my scenario? I'm only thinking using the view modal on the notification modal so admin will be able to view the data right away even if the admin is on other page/s of the admin im being too dumb on explaning lol, it should be customer not user, I kept saying user....
Chrysippus
ChrysippusOP16mo ago
Hello SIr, can i ask one more thing? I dont know how to trigger or send a notification from customer-side to admin-side do you have a link for this too? as im only using filament on my admin side
toeknee
toeknee16mo ago
Use notifications as normal, but setup database notifications. Then the based icon will show their count
Chrysippus
ChrysippusOP16mo ago
Hello sir, I am now able to send the data to database notifications idk what's next, should I go and setup filament to receive the notification? if yes what should I do since the data came from customer-side?
toeknee
toeknee16mo ago
If you setup database notifications the backend will have them in the icon clicking the icon will reveal it?
Chrysippus
ChrysippusOP16mo ago
yes sir, i have setup that too. I think im ready to get the data and show it to notification modal, dunno which step is next since im not using filament on my customer side.
toeknee
toeknee16mo ago
just add ->sendToDatabase(auth()->user()) to the notification? I assume you are using laravel for the custom side? If so, just include the notifications package in the fucntion and send to database as per abvoe
Chrysippus
ChrysippusOP16mo ago
im lost sir, all I know is ->sendToDatabase() is from filament but I dunno which function you're refering to. this is how I send notification on my checkoutController after order placed
// Clear the cart
Cart::instance('shopping')->destroy();

$response['status'] = true;
$response['cod'] = true;
$response['message'] = "Order placed successfully.";

$adminUsers = User::where('is_admin', 1)->get();
Notification::send($adminUsers, new OrderPlaced($order));
// Clear the cart
Cart::instance('shopping')->destroy();

$response['status'] = true;
$response['cod'] = true;
$response['message'] = "Order placed successfully.";

$adminUsers = User::where('is_admin', 1)->get();
Notification::send($adminUsers, new OrderPlaced($order));
toeknee
toeknee16mo ago
Notification::sendToDatabase($adminUsers)->send($adminUsers, new OrderPlaced($order));
Notification::sendToDatabase($adminUsers)->send($adminUsers, new OrderPlaced($order));
Chrysippus
ChrysippusOP16mo ago
it's being highlighted as "add method" sir Method 'sendToDatabase' not found in void should i just ignore it. sorry about this, im complete new to it
toeknee
toeknee16mo ago
Updated it
Chrysippus
ChrysippusOP16mo ago
it's returning an undefined error sir message: "Call to undefined method Illuminate\Notifications\Channels\MailChannel::sendToDatabase()"
toeknee
toeknee16mo ago
Errr you are using Channels? Not Filament Notifications there.
Chrysippus
ChrysippusOP16mo ago
how can I used the filament Notification sir? should i just extends it?
toeknee
toeknee16mo ago
Please read the documentaiton for notifications It's very simple.
Chrysippus
ChrysippusOP16mo ago
is it this one sir? \Filament\Notifications\Notification
Want results from more Discord servers?
Add your server