[增添]添加了datasource的setting数据库以及默认值
This commit is contained in:
13
vendor/filament/notifications/.stubs.php
vendored
Normal file
13
vendor/filament/notifications/.stubs.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Livewire\Features\SupportTesting {
|
||||
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
class Testable {
|
||||
public function assertNotified(Notification | string $notification = null): static {}
|
||||
|
||||
public function assertNotNotified(Notification | string $notification = null): static {}
|
||||
}
|
||||
|
||||
}
|
||||
40
vendor/filament/notifications/composer.json
vendored
Normal file
40
vendor/filament/notifications/composer.json
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "filament/notifications",
|
||||
"description": "Easily add beautiful notifications to any Livewire app.",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/filamentphp/filament",
|
||||
"support": {
|
||||
"issues": "https://github.com/filamentphp/filament/issues",
|
||||
"source": "https://github.com/filamentphp/filament"
|
||||
},
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"filament/actions": "self.version",
|
||||
"filament/support": "self.version",
|
||||
"illuminate/contracts": "^10.45|^11.0",
|
||||
"illuminate/filesystem": "^10.45|^11.0",
|
||||
"illuminate/notifications": "^10.45|^11.0",
|
||||
"illuminate/support": "^10.45|^11.0",
|
||||
"spatie/laravel-package-tools": "^1.9"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Filament\\Notifications\\": "src"
|
||||
},
|
||||
"files": [
|
||||
"src/Testing/Autoload.php"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Filament\\Notifications\\NotificationsServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
1
vendor/filament/notifications/dist/index.js
vendored
Normal file
1
vendor/filament/notifications/dist/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
176
vendor/filament/notifications/docs/01-installation.md
vendored
Normal file
176
vendor/filament/notifications/docs/01-installation.md
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
---
|
||||
title: Installation
|
||||
---
|
||||
|
||||
**The Notifications package is pre-installed with the [Panel Builder](/docs/panels).** This guide is for using the Notifications package in a custom TALL Stack application (Tailwind, Alpine, Livewire, Laravel).
|
||||
|
||||
## Requirements
|
||||
|
||||
Filament requires the following to run:
|
||||
|
||||
- PHP 8.1+
|
||||
- Laravel v10.0+
|
||||
- Livewire v3.0+
|
||||
|
||||
Require the Notifications package using Composer:
|
||||
|
||||
```bash
|
||||
composer require filament/notifications:"^3.2" -W
|
||||
```
|
||||
|
||||
## New Laravel projects
|
||||
|
||||
To quickly get started with Filament in a new Laravel project, run the following commands to install [Livewire](https://livewire.laravel.com), [Alpine.js](https://alpinejs.dev), and [Tailwind CSS](https://tailwindcss.com):
|
||||
|
||||
> Since these commands will overwrite existing files in your application, only run this in a new Laravel project!
|
||||
|
||||
```bash
|
||||
php artisan filament:install --scaffold --notifications
|
||||
|
||||
npm install
|
||||
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## Existing Laravel projects
|
||||
|
||||
Run the following command to install the Notifications package assets:
|
||||
|
||||
```bash
|
||||
php artisan filament:install --notifications
|
||||
```
|
||||
|
||||
### Installing Tailwind CSS
|
||||
|
||||
Run the following command to install Tailwind CSS with the Tailwind Forms and Typography plugins:
|
||||
|
||||
```bash
|
||||
npm install tailwindcss @tailwindcss/forms @tailwindcss/typography postcss postcss-nesting autoprefixer --save-dev
|
||||
```
|
||||
|
||||
Create a new `tailwind.config.js` file and add the Filament `preset` *(includes the Filament color scheme and the required Tailwind plugins)*:
|
||||
|
||||
```js
|
||||
import preset from './vendor/filament/support/tailwind.config.preset'
|
||||
|
||||
export default {
|
||||
presets: [preset],
|
||||
content: [
|
||||
'./app/Filament/**/*.php',
|
||||
'./resources/views/filament/**/*.blade.php',
|
||||
'./vendor/filament/**/*.blade.php',
|
||||
],
|
||||
}
|
||||
```
|
||||
|
||||
### Configuring styles
|
||||
|
||||
Add Tailwind's CSS layers to your `resources/css/app.css`:
|
||||
|
||||
```css
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
```
|
||||
|
||||
Create a `postcss.config.js` file in the root of your project and register Tailwind CSS, PostCSS Nesting and Autoprefixer as plugins:
|
||||
|
||||
```js
|
||||
export default {
|
||||
plugins: {
|
||||
'tailwindcss/nesting': 'postcss-nesting',
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
### Automatically refreshing the browser
|
||||
You may also want to update your `vite.config.js` file to refresh the page automatically when Livewire components are updated:
|
||||
|
||||
```js
|
||||
import { defineConfig } from 'vite'
|
||||
import laravel, { refreshPaths } from 'laravel-vite-plugin'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
laravel({
|
||||
input: ['resources/css/app.css', 'resources/js/app.js'],
|
||||
refresh: [
|
||||
...refreshPaths,
|
||||
'app/Livewire/**',
|
||||
],
|
||||
}),
|
||||
],
|
||||
})
|
||||
```
|
||||
|
||||
### Compiling assets
|
||||
|
||||
Compile your new CSS and Javascript assets using `npm run dev`.
|
||||
|
||||
### Configuring your layout
|
||||
|
||||
Create a new `resources/views/components/layouts/app.blade.php` layout file for Livewire components:
|
||||
|
||||
```blade
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="application-name" content="{{ config('app.name') }}">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>{{ config('app.name') }}</title>
|
||||
|
||||
<style>
|
||||
[x-cloak] {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@filamentStyles
|
||||
@vite('resources/css/app.css')
|
||||
</head>
|
||||
|
||||
<body class="antialiased">
|
||||
{{ $slot }}
|
||||
|
||||
@livewire('notifications')
|
||||
|
||||
@filamentScripts
|
||||
@vite('resources/js/app.js')
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
## Publishing configuration
|
||||
|
||||
You can publish the package configuration using the following command (optional):
|
||||
|
||||
```bash
|
||||
php artisan vendor:publish --tag=filament-config
|
||||
```
|
||||
|
||||
## Upgrading
|
||||
|
||||
> Upgrading from Filament v2? Please review the [upgrade guide](upgrade-guide).
|
||||
|
||||
Filament automatically upgrades to the latest non-breaking version when you run `composer update`. After any updates, all Laravel caches need to be cleared, and frontend assets need to be republished. You can do this all at once using the `filament:upgrade` command, which should have been added to your `composer.json` file when you ran `filament:install` the first time:
|
||||
|
||||
```json
|
||||
"post-autoload-dump": [
|
||||
// ...
|
||||
"@php artisan filament:upgrade"
|
||||
],
|
||||
```
|
||||
|
||||
Please note that `filament:upgrade` does not actually handle the update process, as Composer does that already. If you're upgrading manually without a `post-autoload-dump` hook, you can run the command yourself:
|
||||
|
||||
```bash
|
||||
composer update
|
||||
|
||||
php artisan filament:upgrade
|
||||
```
|
||||
427
vendor/filament/notifications/docs/02-sending-notifications.md
vendored
Normal file
427
vendor/filament/notifications/docs/02-sending-notifications.md
vendored
Normal file
@@ -0,0 +1,427 @@
|
||||
---
|
||||
title: Sending notifications
|
||||
---
|
||||
import AutoScreenshot from "@components/AutoScreenshot.astro"
|
||||
|
||||
## Overview
|
||||
|
||||
> To start, make sure the package is [installed](installation) - `@livewire('notifications')` should be in your Blade layout somewhere.
|
||||
|
||||
Notifications are sent using a `Notification` object that's constructed through a fluent API. Calling the `send()` method on the `Notification` object will dispatch the notification and display it in your application. As the session is used to flash notifications, they can be sent from anywhere in your code, including JavaScript, not just Livewire components.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use Filament\Notifications\Notification;
|
||||
use Livewire\Component;
|
||||
|
||||
class EditPost extends Component
|
||||
{
|
||||
public function save(): void
|
||||
{
|
||||
// ...
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<AutoScreenshot name="notifications/success" alt="Success notification" version="3.x" />
|
||||
|
||||
## Setting a title
|
||||
|
||||
The main message of the notification is shown in the title. You can set the title as follows:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->send();
|
||||
```
|
||||
|
||||
The title text can contain basic, safe HTML elements. To generate safe HTML with Markdown, you can use the [`Str::markdown()` helper](https://laravel.com/docs/strings#method-str-markdown): `title(Str::markdown('Saved **successfully**'))`
|
||||
|
||||
Or with JavaScript:
|
||||
|
||||
```js
|
||||
new FilamentNotification()
|
||||
.title('Saved successfully')
|
||||
.send()
|
||||
```
|
||||
|
||||
## Setting an icon
|
||||
|
||||
Optionally, a notification can have an [icon](https://blade-ui-kit.com/blade-icons?set=1#search) that's displayed in front of its content. You may also set a color for the icon, which is gray by default:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->icon('heroicon-o-document-text')
|
||||
->iconColor('success')
|
||||
->send();
|
||||
```
|
||||
|
||||
Or with JavaScript:
|
||||
|
||||
```js
|
||||
new FilamentNotification()
|
||||
.title('Saved successfully')
|
||||
.icon('heroicon-o-document-text')
|
||||
.iconColor('success')
|
||||
.send()
|
||||
```
|
||||
|
||||
<AutoScreenshot name="notifications/icon" alt="Notification with icon" version="3.x" />
|
||||
|
||||
Notifications often have a status like `success`, `warning`, `danger` or `info`. Instead of manually setting the corresponding icons and colors, there's a `status()` method which you can pass the status. You may also use the dedicated `success()`, `warning()`, `danger()` and `info()` methods instead. So, cleaning up the above example would look like this:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->success()
|
||||
->send();
|
||||
```
|
||||
|
||||
Or with JavaScript:
|
||||
|
||||
```js
|
||||
new FilamentNotification()
|
||||
.title('Saved successfully')
|
||||
.success()
|
||||
.send()
|
||||
```
|
||||
|
||||
<AutoScreenshot name="notifications/statuses" alt="Notifications with various statuses" version="3.x" />
|
||||
|
||||
## Setting a background color
|
||||
|
||||
Notifications have no background color by default. You may want to provide additional context to your notification by setting a color as follows:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->color('success') // [tl! focus]
|
||||
->send();
|
||||
```
|
||||
|
||||
Or with JavaScript:
|
||||
|
||||
```js
|
||||
new FilamentNotification()
|
||||
.title('Saved successfully')
|
||||
.color('success') // [tl! focus]
|
||||
.send()
|
||||
```
|
||||
|
||||
<AutoScreenshot name="notifications/color" alt="Notification with background color" version="3.x" />
|
||||
|
||||
## Setting a duration
|
||||
|
||||
By default, notifications are shown for 6 seconds before they're automatically closed. You may specify a custom duration value in milliseconds as follows:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->success()
|
||||
->duration(5000)
|
||||
->send();
|
||||
```
|
||||
|
||||
Or with JavaScript:
|
||||
|
||||
```js
|
||||
new FilamentNotification()
|
||||
.title('Saved successfully')
|
||||
.success()
|
||||
.duration(5000)
|
||||
.send()
|
||||
```
|
||||
|
||||
If you prefer setting a duration in seconds instead of milliseconds, you can do so:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->success()
|
||||
->seconds(5)
|
||||
->send();
|
||||
```
|
||||
|
||||
Or with JavaScript:
|
||||
|
||||
```js
|
||||
new FilamentNotification()
|
||||
.title('Saved successfully')
|
||||
.success()
|
||||
.seconds(5)
|
||||
.send()
|
||||
```
|
||||
|
||||
You might want some notifications to not automatically close and require the user to close them manually. This can be achieved by making the notification persistent:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->success()
|
||||
->persistent()
|
||||
->send();
|
||||
```
|
||||
|
||||
Or with JavaScript:
|
||||
|
||||
```js
|
||||
new FilamentNotification()
|
||||
.title('Saved successfully')
|
||||
.success()
|
||||
.persistent()
|
||||
.send()
|
||||
```
|
||||
|
||||
## Setting body text
|
||||
|
||||
Additional notification text can be shown in the `body()`:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->success()
|
||||
->body('Changes to the post have been saved.')
|
||||
->send();
|
||||
```
|
||||
|
||||
The body text can contain basic, safe HTML elements. To generate safe HTML with Markdown, you can use the [`Str::markdown()` helper](https://laravel.com/docs/strings#method-str-markdown): `body(Str::markdown('Changes to the **post** have been saved.'))`
|
||||
|
||||
Or with JavaScript:
|
||||
|
||||
```js
|
||||
new FilamentNotification()
|
||||
.title('Saved successfully')
|
||||
.success()
|
||||
.body('Changes to the post have been saved.')
|
||||
.send()
|
||||
```
|
||||
|
||||
<AutoScreenshot name="notifications/body" alt="Notification with body text" version="3.x" />
|
||||
|
||||
## Adding actions to notifications
|
||||
|
||||
Notifications support [Actions](../actions/trigger-button), which are buttons that render below the content of the notification. They can open a URL or dispatch a Livewire event. Actions can be defined as follows:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Actions\Action;
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->success()
|
||||
->body('Changes to the post have been saved.')
|
||||
->actions([
|
||||
Action::make('view')
|
||||
->button(),
|
||||
Action::make('undo')
|
||||
->color('gray'),
|
||||
])
|
||||
->send();
|
||||
```
|
||||
|
||||
Or with JavaScript:
|
||||
|
||||
```js
|
||||
new FilamentNotification()
|
||||
.title('Saved successfully')
|
||||
.success()
|
||||
.body('Changes to the post have been saved.')
|
||||
.actions([
|
||||
new FilamentNotificationAction('view')
|
||||
.button(),
|
||||
new FilamentNotificationAction('undo')
|
||||
.color('gray'),
|
||||
])
|
||||
.send()
|
||||
```
|
||||
|
||||
<AutoScreenshot name="notifications/actions" alt="Notification with actions" version="3.x" />
|
||||
|
||||
You can learn more about how to style action buttons [here](../actions/trigger-button).
|
||||
|
||||
### Opening URLs from notification actions
|
||||
|
||||
You can open a URL, optionally in a new tab, when clicking on an action:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Actions\Action;
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->success()
|
||||
->body('Changes to the post have been saved.')
|
||||
->actions([
|
||||
Action::make('view')
|
||||
->button()
|
||||
->url(route('posts.show', $post), shouldOpenInNewTab: true)
|
||||
Action::make('undo')
|
||||
->color('gray'),
|
||||
])
|
||||
->send();
|
||||
```
|
||||
|
||||
Or with JavaScript:
|
||||
|
||||
```js
|
||||
new FilamentNotification()
|
||||
.title('Saved successfully')
|
||||
.success()
|
||||
.body('Changes to the post have been saved.')
|
||||
.actions([
|
||||
new FilamentNotificationAction('view')
|
||||
.button()
|
||||
.url('/view')
|
||||
.openUrlInNewTab(),
|
||||
new FilamentNotificationAction('undo')
|
||||
.color('gray'),
|
||||
])
|
||||
.send()
|
||||
```
|
||||
|
||||
### Dispatching Livewire events from notification actions
|
||||
|
||||
Sometimes you want to execute additional code when a notification action is clicked. This can be achieved by setting a Livewire event which should be dispatched on clicking the action. You may optionally pass an array of data, which will be available as parameters in the event listener on your Livewire component:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Actions\Action;
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->success()
|
||||
->body('Changes to the post have been saved.')
|
||||
->actions([
|
||||
Action::make('view')
|
||||
->button()
|
||||
->url(route('posts.show', $post), shouldOpenInNewTab: true),
|
||||
Action::make('undo')
|
||||
->color('gray')
|
||||
->dispatch('undoEditingPost', [$post->id]),
|
||||
])
|
||||
->send();
|
||||
```
|
||||
|
||||
You can also `dispatchSelf` and `dispatchTo`:
|
||||
|
||||
```php
|
||||
Action::make('undo')
|
||||
->color('gray')
|
||||
->dispatchSelf('undoEditingPost', [$post->id])
|
||||
|
||||
Action::make('undo')
|
||||
->color('gray')
|
||||
->dispatchTo('another_component', 'undoEditingPost', [$post->id])
|
||||
```
|
||||
|
||||
Or with JavaScript:
|
||||
|
||||
```js
|
||||
new FilamentNotification()
|
||||
.title('Saved successfully')
|
||||
.success()
|
||||
.body('Changes to the post have been saved.')
|
||||
.actions([
|
||||
new FilamentNotificationAction('view')
|
||||
.button()
|
||||
.url('/view')
|
||||
.openUrlInNewTab(),
|
||||
new FilamentNotificationAction('undo')
|
||||
.color('gray')
|
||||
.dispatch('undoEditingPost'),
|
||||
])
|
||||
.send()
|
||||
```
|
||||
|
||||
Similarly, `dispatchSelf` and `dispatchTo` are also available:
|
||||
|
||||
```js
|
||||
new FilamentNotificationAction('undo')
|
||||
.color('gray')
|
||||
.dispatchSelf('undoEditingPost')
|
||||
|
||||
new FilamentNotificationAction('undo')
|
||||
.color('gray')
|
||||
.dispatchTo('another_component', 'undoEditingPost')
|
||||
```
|
||||
|
||||
### Closing notifications from actions
|
||||
|
||||
After opening a URL or dispatching an event from your action, you may want to close the notification right away:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Actions\Action;
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->success()
|
||||
->body('Changes to the post have been saved.')
|
||||
->actions([
|
||||
Action::make('view')
|
||||
->button()
|
||||
->url(route('posts.show', $post), shouldOpenInNewTab: true),
|
||||
Action::make('undo')
|
||||
->color('gray')
|
||||
->dispatch('undoEditingPost', [$post->id])
|
||||
->close(),
|
||||
])
|
||||
->send();
|
||||
```
|
||||
|
||||
Or with JavaScript:
|
||||
|
||||
```js
|
||||
new FilamentNotification()
|
||||
.title('Saved successfully')
|
||||
.success()
|
||||
.body('Changes to the post have been saved.')
|
||||
.actions([
|
||||
new FilamentNotificationAction('view')
|
||||
.button()
|
||||
.url('/view')
|
||||
.openUrlInNewTab(),
|
||||
new FilamentNotificationAction('undo')
|
||||
.color('gray')
|
||||
.dispatch('undoEditingPost')
|
||||
.close(),
|
||||
])
|
||||
.send()
|
||||
```
|
||||
|
||||
## Using the JavaScript objects
|
||||
|
||||
The JavaScript objects (`FilamentNotification` and `FilamentNotificationAction`) are assigned to `window.FilamentNotification` and `window.FilamentNotificationAction`, so they are available in on-page scripts.
|
||||
|
||||
You may also import them in a bundled JavaScript file:
|
||||
|
||||
```js
|
||||
import { Notification, NotificationAction } from '../../vendor/filament/notifications/dist/index.js'
|
||||
|
||||
// ...
|
||||
```
|
||||
210
vendor/filament/notifications/docs/03-database-notifications.md
vendored
Normal file
210
vendor/filament/notifications/docs/03-database-notifications.md
vendored
Normal file
@@ -0,0 +1,210 @@
|
||||
---
|
||||
title: Database notifications
|
||||
---
|
||||
import AutoScreenshot from "@components/AutoScreenshot.astro"
|
||||
|
||||
<AutoScreenshot name="notifications/database" alt="Database notifications" version="3.x" />
|
||||
|
||||
## Setting up the notifications database table
|
||||
|
||||
Before we start, make sure that the [Laravel notifications table](https://laravel.com/docs/notifications#database-prerequisites) is added to your database:
|
||||
|
||||
```bash
|
||||
# Laravel 11 and higher
|
||||
php artisan make:notifications-table
|
||||
|
||||
# Laravel 10
|
||||
php artisan notifications:table
|
||||
```
|
||||
|
||||
> If you're using PostgreSQL, make sure that the `data` column in the migration is using `json()`: `$table->json('data')`.
|
||||
|
||||
> If you're using UUIDs for your `User` model, make sure that your `notifiable` column is using `uuidMorphs()`: `$table->uuidMorphs('notifiable')`.
|
||||
|
||||
## Rendering the database notifications modal
|
||||
|
||||
> If you want to add database notifications to a panel, [follow this part of the guide](#adding-the-database-notifications-modal-to-a-panel).
|
||||
|
||||
If you'd like to render the database notifications modal outside of the [Panel Builder](../panels), you'll need to add a new Livewire component to your Blade layout:
|
||||
|
||||
```blade
|
||||
@livewire('database-notifications')
|
||||
```
|
||||
|
||||
To open the modal, you must have a "trigger" button in your view. Create a new trigger button component in your app, for instance at `/resources/views/filament/notifications/database-notifications-trigger.blade.php`:
|
||||
|
||||
```blade
|
||||
<button type="button">
|
||||
Notifications ({{ $unreadNotificationsCount }} unread)
|
||||
</button>
|
||||
```
|
||||
|
||||
`$unreadNotificationsCount` is a variable automatically passed to this view, which provides it with a real-time count of unread notifications the user has.
|
||||
|
||||
In the service provider, point to this new trigger view:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Livewire\DatabaseNotifications;
|
||||
|
||||
DatabaseNotifications::trigger('filament.notifications.database-notifications-trigger');
|
||||
```
|
||||
|
||||
Now, click on the trigger button that is rendered in your view. A modal should appear containing your database notifications when clicked!
|
||||
|
||||
### Adding the database notifications modal to a panel
|
||||
|
||||
You can enable database notifications in a panel's [configuration](../panels/configuration):
|
||||
|
||||
```php
|
||||
use Filament\Panel;
|
||||
|
||||
public function panel(Panel $panel): Panel
|
||||
{
|
||||
return $panel
|
||||
// ...
|
||||
->databaseNotifications();
|
||||
}
|
||||
```
|
||||
|
||||
To learn more, visit the [Panel Builder documentation](../panels/notifications).
|
||||
|
||||
## Sending database notifications
|
||||
|
||||
There are several ways to send database notifications, depending on which one suits you best.
|
||||
|
||||
You may use our fluent API:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
$recipient = auth()->user();
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->sendToDatabase($recipient);
|
||||
```
|
||||
|
||||
Or, use the `notify()` method:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
$recipient = auth()->user();
|
||||
|
||||
$recipient->notify(
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->toDatabase(),
|
||||
);
|
||||
```
|
||||
|
||||
> Laravel sends database notifications using the queue. Ensure your queue is running in order to receive the notifications.
|
||||
|
||||
Alternatively, use a traditional [Laravel notification class](https://laravel.com/docs/notifications#generating-notifications) by returning the notification from the `toDatabase()` method:
|
||||
|
||||
```php
|
||||
use App\Models\User;
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
public function toDatabase(User $notifiable): array
|
||||
{
|
||||
return Notification::make()
|
||||
->title('Saved successfully')
|
||||
->getDatabaseMessage();
|
||||
}
|
||||
```
|
||||
|
||||
## Receiving database notifications
|
||||
|
||||
Without any setup, new database notifications will only be received when the page is first loaded.
|
||||
|
||||
### Polling for new database notifications
|
||||
|
||||
Polling is the practice of periodically making a request to the server to check for new notifications. This is a good approach as the setup is simple, but some may say that it is not a scalable solution as it increases server load.
|
||||
|
||||
By default, Livewire polls for new notifications every 30 seconds:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Livewire\DatabaseNotifications;
|
||||
|
||||
DatabaseNotifications::pollingInterval('30s');
|
||||
```
|
||||
|
||||
You may completely disable polling if you wish:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Livewire\DatabaseNotifications;
|
||||
|
||||
DatabaseNotifications::pollingInterval(null);
|
||||
```
|
||||
|
||||
### Using Echo to receive new database notifications with websockets
|
||||
|
||||
Alternatively, the package has a native integration with [Laravel Echo](https://laravel.com/docs/broadcasting#client-side-installation). Make sure Echo is installed, as well as a [server-side websockets integration](https://laravel.com/docs/broadcasting#server-side-installation) like Pusher.
|
||||
|
||||
Once websockets are set up, after sending a database notification you may dispatch a `DatabaseNotificationsSent` event, which will immediately fetch new notifications for that user:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Events\DatabaseNotificationsSent;
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
$recipient = auth()->user();
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->sendToDatabase($recipient);
|
||||
|
||||
event(new DatabaseNotificationsSent($recipient));
|
||||
```
|
||||
|
||||
## Marking database notifications as read
|
||||
|
||||
There is a button at the top of the modal to mark all notifications as read at once. You may also add [Actions](sending-notifications#adding-actions-to-notifications) to notifications, which you can use to mark individual notifications as read. To do this, use the `markAsRead()` method on the action:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Actions\Action;
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->success()
|
||||
->body('Changes to the post have been saved.')
|
||||
->actions([
|
||||
Action::make('view')
|
||||
->button()
|
||||
->markAsRead(),
|
||||
])
|
||||
->send();
|
||||
```
|
||||
|
||||
Alternatively, you may use the `markAsUnread()` method to mark a notification as unread:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Actions\Action;
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->success()
|
||||
->body('Changes to the post have been saved.')
|
||||
->actions([
|
||||
Action::make('markAsUnread')
|
||||
->button()
|
||||
->markAsUnread(),
|
||||
])
|
||||
->send();
|
||||
```
|
||||
|
||||
## Opening the database notifications modal
|
||||
|
||||
Instead of rendering the trigger button as described above, you can always open the database notifications modal from anywhere by dispatching an `open-modal` browser event:
|
||||
|
||||
```blade
|
||||
<button
|
||||
x-data="{}"
|
||||
x-on:click="$dispatch('open-modal', { id: 'database-notifications' })"
|
||||
type="button"
|
||||
>
|
||||
Notifications
|
||||
</button>
|
||||
```
|
||||
56
vendor/filament/notifications/docs/04-broadcast-notifications.md
vendored
Normal file
56
vendor/filament/notifications/docs/04-broadcast-notifications.md
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
title: Broadcast notifications
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
> To start, make sure the package is [installed](installation) - `@livewire('notifications')` should be in your Blade layout somewhere.
|
||||
|
||||
By default, Filament will send flash notifications via the Laravel session. However, you may wish that your notifications are "broadcast" to a user in real-time, instead. This could be used to send a temporary success notification from a queued job after it has finished processing.
|
||||
|
||||
We have a native integration with [Laravel Echo](https://laravel.com/docs/broadcasting#client-side-installation). Make sure Echo is installed, as well as a [server-side websockets integration](https://laravel.com/docs/broadcasting#server-side-installation) like Pusher.
|
||||
|
||||
## Sending broadcast notifications
|
||||
|
||||
There are several ways to send broadcast notifications, depending on which one suits you best.
|
||||
|
||||
You may use our fluent API:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
$recipient = auth()->user();
|
||||
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->broadcast($recipient);
|
||||
```
|
||||
|
||||
Or, use the `notify()` method:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
$recipient = auth()->user();
|
||||
|
||||
$recipient->notify(
|
||||
Notification::make()
|
||||
->title('Saved successfully')
|
||||
->toBroadcast(),
|
||||
)
|
||||
```
|
||||
|
||||
Alternatively, use a traditional [Laravel notification class](https://laravel.com/docs/notifications#generating-notifications) by returning the notification from the `toBroadcast()` method:
|
||||
|
||||
```php
|
||||
use App\Models\User;
|
||||
use Filament\Notifications\Notification;
|
||||
use Illuminate\Notifications\Messages\BroadcastMessage;
|
||||
|
||||
public function toBroadcast(User $notifiable): BroadcastMessage
|
||||
{
|
||||
return Notification::make()
|
||||
->title('Saved successfully')
|
||||
->getBroadcastMessage();
|
||||
}
|
||||
```
|
||||
126
vendor/filament/notifications/docs/05-customizing-notifications.md
vendored
Normal file
126
vendor/filament/notifications/docs/05-customizing-notifications.md
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
---
|
||||
title: Customizing notifications
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Notifications come fully styled out of the box. However, if you want to apply your own styling or use a custom view to render notifications, there are multiple options.
|
||||
|
||||
## Styling notifications
|
||||
|
||||
Notifications have dedicated CSS classes you can hook into to apply your own styling. Open the inspector in your browser to find out which classes you need to target.
|
||||
|
||||
## Positioning notifications
|
||||
|
||||
You can configure the alignment of the notifications in a service provider or middleware, by calling `Notifications::alignment()` and `Notifications::verticalAlignment()`. You can pass `Alignment::Start`, `Alignment::Center`, `Alignment::End`, `VerticalAlignment::Start`, `VerticalAlignment::Center` or `VerticalAlignment::End`:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Livewire\Notifications;
|
||||
use Filament\Support\Enums\Alignment;
|
||||
use Filament\Support\Enums\VerticalAlignment;
|
||||
|
||||
Notifications::alignment(Alignment::Start);
|
||||
Notifications::verticalAlignment(VerticalAlignment::End);
|
||||
```
|
||||
|
||||
## Using a custom notification view
|
||||
|
||||
If your desired customization can't be achieved using the CSS classes above, you can create a custom view to render the notification. To configure the notification view, call the static `configureUsing()` method inside a service provider's `boot()` method and specify the view to use:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
Notification::configureUsing(function (Notification $notification): void {
|
||||
$notification->view('filament-notifications.notification');
|
||||
});
|
||||
```
|
||||
|
||||
Next, create the view, in this example `resources/views/notifications/notification.blade.php`. The view should use the package's base notification component for the notification functionality and pass the available `$notification` variable through the `notification` attribute. This is the bare minimum required to create your own notification view:
|
||||
|
||||
```blade
|
||||
<x-filament-notifications::notification :notification="$notification">
|
||||
{{-- Notification content --}}
|
||||
</x-filament-notifications::notification>
|
||||
```
|
||||
|
||||
Getters for all notification properties will be available in the view. So, a custom notification view might look like this:
|
||||
|
||||
```blade
|
||||
<x-filament-notifications::notification
|
||||
:notification="$notification"
|
||||
class="flex w-80 rounded-lg transition duration-200"
|
||||
x-transition:enter-start="opacity-0"
|
||||
x-transition:leave-end="opacity-0"
|
||||
>
|
||||
<h4>
|
||||
{{ $getTitle() }}
|
||||
</h4>
|
||||
|
||||
<p>
|
||||
{{ $getDate() }}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
{{ $getBody() }}
|
||||
</p>
|
||||
|
||||
<span x-on:click="close">
|
||||
Close
|
||||
</span>
|
||||
</x-filament-notifications::notification>
|
||||
```
|
||||
|
||||
## Using a custom notification object
|
||||
|
||||
Maybe your notifications require additional functionality that's not defined in the package's `Notification` class. Then you can create your own `Notification` class, which extends the package's `Notification` class. For example, your notification design might need a size property.
|
||||
|
||||
Your custom `Notification` class in `app/Notifications/Notification.php` might contain:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use Filament\Notifications\Notification as BaseNotification;
|
||||
|
||||
class Notification extends BaseNotification
|
||||
{
|
||||
protected string $size = 'md';
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
...parent::toArray(),
|
||||
'size' => $this->getSize(),
|
||||
];
|
||||
}
|
||||
|
||||
public static function fromArray(array $data): static
|
||||
{
|
||||
return parent::fromArray($data)->size($data['size']);
|
||||
}
|
||||
|
||||
public function size(string $size): static
|
||||
{
|
||||
$this->size = $size;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSize(): string
|
||||
{
|
||||
return $this->size;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Next, you should bind your custom `Notification` class into the container inside a service provider's `register()` method:
|
||||
|
||||
```php
|
||||
use App\Notifications\Notification;
|
||||
use Filament\Notifications\Notification as BaseNotification;
|
||||
|
||||
$this->app->bind(BaseNotification::class, Notification::class);
|
||||
```
|
||||
|
||||
You can now use your custom `Notification` class in the same way as you would with the default `Notification` object.
|
||||
85
vendor/filament/notifications/docs/06-testing.md
vendored
Normal file
85
vendor/filament/notifications/docs/06-testing.md
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
---
|
||||
title: Testing
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
All examples in this guide will be written using [Pest](https://pestphp.com). To use Pest's Livewire plugin for testing, you can follow the installation instructions in the Pest documentation on plugins: [Livewire plugin for Pest](https://pestphp.com/docs/plugins#livewire). However, you can easily adapt this to PHPUnit.
|
||||
|
||||
## Testing session notifications
|
||||
|
||||
To check if a notification was sent using the session, use the `assertNotified()` helper:
|
||||
|
||||
```php
|
||||
use function Pest\Livewire\livewire;
|
||||
|
||||
it('sends a notification', function () {
|
||||
livewire(CreatePost::class)
|
||||
->assertNotified();
|
||||
});
|
||||
```
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
it('sends a notification', function () {
|
||||
Notification::assertNotified();
|
||||
});
|
||||
```
|
||||
|
||||
```php
|
||||
use function Filament\Notifications\Testing\assertNotified;
|
||||
|
||||
it('sends a notification', function () {
|
||||
assertNotified();
|
||||
});
|
||||
```
|
||||
|
||||
You may optionally pass a notification title to test for:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
use function Pest\Livewire\livewire;
|
||||
|
||||
it('sends a notification', function () {
|
||||
livewire(CreatePost::class)
|
||||
->assertNotified('Unable to create post');
|
||||
});
|
||||
```
|
||||
|
||||
Or test if the exact notification was sent:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
use function Pest\Livewire\livewire;
|
||||
|
||||
it('sends a notification', function () {
|
||||
livewire(CreatePost::class)
|
||||
->assertNotified(
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Unable to create post')
|
||||
->body('Something went wrong.'),
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
Conversely, you can assert that a notification was not sent:
|
||||
|
||||
```php
|
||||
use Filament\Notifications\Notification;
|
||||
use function Pest\Livewire\livewire;
|
||||
|
||||
it('does not send a notification', function () {
|
||||
livewire(CreatePost::class)
|
||||
->assertNotNotified()
|
||||
// or
|
||||
->assertNotNotified('Unable to create post')
|
||||
// or
|
||||
->assertNotified(
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Unable to create post')
|
||||
->body('Something went wrong.'),
|
||||
);
|
||||
```
|
||||
66
vendor/filament/notifications/docs/07-upgrade-guide.md
vendored
Normal file
66
vendor/filament/notifications/docs/07-upgrade-guide.md
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
---
|
||||
title: Upgrading from v2.x
|
||||
---
|
||||
|
||||
> If you see anything missing from this guide, please do not hesitate to [make a pull request](https://github.com/filamentphp/filament/edit/3.x/packages/notifications/docs/07-upgrade-guide.md) to our repository! Any help is appreciated!
|
||||
|
||||
## New requirements
|
||||
|
||||
- Laravel v10.0+
|
||||
- Livewire v3.0+
|
||||
|
||||
Please upgrade Filament before upgrading to Livewire v3. Instructions on how to upgrade Livewire can be found [here](https://livewire.laravel.com/docs/upgrading).
|
||||
|
||||
## Upgrading automatically
|
||||
|
||||
The easiest way to upgrade your app is to run the automated upgrade script. This script will automatically upgrade your application to the latest version of Filament, and make changes to your code which handle most breaking changes.
|
||||
|
||||
```bash
|
||||
composer require filament/upgrade:"^3.2" -W --dev
|
||||
vendor/bin/filament-v3
|
||||
```
|
||||
|
||||
Make sure to carefully follow the instructions, and review the changes made by the script. You may need to make some manual changes to your code afterwards, but the script should handle most of the repetitive work for you.
|
||||
|
||||
Finally, you must run `php artisan filament:install` to finalize the Filament v3 installation. This command must be run for all new Filament projects.
|
||||
|
||||
You can now `composer remove filament/upgrade` as you don't need it anymore.
|
||||
|
||||
> Some plugins you're using may not be available in v3 just yet. You could temporarily remove them from your `composer.json` file until they've been upgraded, replace them with a similar plugins that are v3-compatible, wait for the plugins to be upgraded before upgrading your app, or even write PRs to help the authors upgrade them.
|
||||
|
||||
## Upgrading manually
|
||||
|
||||
After upgrading the dependency via Composer, you should execute `php artisan filament:upgrade` in order to clear any Laravel caches and publish the new frontend assets.
|
||||
|
||||
### High-impact changes
|
||||
|
||||
#### Config file renamed and combined with other Filament packages
|
||||
|
||||
Only one config file is now used for all Filament packages. Most configuration has been moved into other parts of the codebase, and little remains. You should use the v3 documentation as a reference when replace the configuration options you did modify. To publish the new configuration file and remove the old one, run:
|
||||
|
||||
```bash
|
||||
php artisan vendor:publish --tag=filament-config --force
|
||||
rm config/notifications.php
|
||||
```
|
||||
|
||||
#### New `@filamentScripts` and `@filamentStyles` Blade directives
|
||||
|
||||
The `@filamentScripts` and `@filamentStyles` Blade directives must be added to your Blade layout file/s. Since Livewire v3 no longer uses similar directives, you can replace `@livewireScripts` with `@filamentScripts` and `@livewireStyles` with `@filamentStyles`.
|
||||
|
||||
#### JavaScript assets
|
||||
|
||||
You no longer need to import the `NotificationsAlpinePlugin` in your JavaScript files. Alpine plugins are now automatically loaded by `@filamentScripts`.
|
||||
|
||||
#### Heroicons have been updated to v2
|
||||
|
||||
The Heroicons library has been updated to v2. This means that any icons you use in your app may have changed names. You can find a list of changes [here](https://github.com/tailwindlabs/heroicons/releases/tag/v2.0.0).
|
||||
|
||||
### Medium-impact changes
|
||||
|
||||
#### Secondary color
|
||||
|
||||
Filament v2 had a `secondary` color for many components which was gray. All references to `secondary` should be replaced with `gray` to preserve the same appearance. This frees `secondary` to be registered to a new custom color of your choice.
|
||||
|
||||
#### Notification JS objects
|
||||
|
||||
The `Notification` JavaScript object has been renamed to `FilamentNotification` to avoid conflicts with the native browser `Notification` object. The same has been done for `NotificationAction` (now `FilamentNotificationAction`) and `NotificationActionGroup` (now `FilamentNotificationActionGroup`) for consistency.
|
||||
346
vendor/filament/notifications/resources/js/Notification.js
vendored
Normal file
346
vendor/filament/notifications/resources/js/Notification.js
vendored
Normal file
@@ -0,0 +1,346 @@
|
||||
import { v4 as uuid } from 'uuid-browser'
|
||||
|
||||
class Notification {
|
||||
constructor() {
|
||||
this.id(uuid())
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
id(id) {
|
||||
this.id = id
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
title(title) {
|
||||
this.title = title
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
body(body) {
|
||||
this.body = body
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
actions(actions) {
|
||||
this.actions = actions
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
status(status) {
|
||||
this.status = status
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
color(color) {
|
||||
this.color = color
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
icon(icon) {
|
||||
this.icon = icon
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
iconColor(color) {
|
||||
this.iconColor = color
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
duration(duration) {
|
||||
this.duration = duration
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
seconds(seconds) {
|
||||
this.duration(seconds * 1000)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
persistent() {
|
||||
this.duration('persistent')
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
danger() {
|
||||
this.status('danger')
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
info() {
|
||||
this.status('info')
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
success() {
|
||||
this.status('success')
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
warning() {
|
||||
this.status('warning')
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
view(view) {
|
||||
this.view = view
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
viewData(viewData) {
|
||||
this.viewData = viewData
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
send() {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('notificationSent', {
|
||||
detail: {
|
||||
notification: this,
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
class Action {
|
||||
constructor(name) {
|
||||
this.name(name)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
name(name) {
|
||||
this.name = name
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
color(color) {
|
||||
this.color = color
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
dispatch(event, data) {
|
||||
this.event(event)
|
||||
this.eventData(data)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
dispatchSelf(event, data) {
|
||||
this.dispatch(event, data)
|
||||
this.dispatchDirection = 'self'
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
dispatchTo(component, event, data) {
|
||||
this.dispatch(event, data)
|
||||
this.dispatchDirection = 'to'
|
||||
this.dispatchToComponent = component
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `dispatch()` instead.
|
||||
*/
|
||||
emit(event, data) {
|
||||
this.dispatch(event, data)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `dispatchSelf()` instead.
|
||||
*/
|
||||
emitSelf(event, data) {
|
||||
this.dispatchSelf(event, data)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `dispatchTo()` instead.
|
||||
*/
|
||||
emitTo(component, event, data) {
|
||||
this.dispatchTo(component, event, data)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
dispatchDirection(dispatchDirection) {
|
||||
this.dispatchDirection = dispatchDirection
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
dispatchToComponent(component) {
|
||||
this.dispatchToComponent = component
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
event(event) {
|
||||
this.event = event
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
eventData(data) {
|
||||
this.eventData = data
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
extraAttributes(attributes) {
|
||||
this.extraAttributes = attributes
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
icon(icon) {
|
||||
this.icon = icon
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
iconPosition(position) {
|
||||
this.iconPosition = position
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
outlined(condition = true) {
|
||||
this.isOutlined = condition
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
disabled(condition = true) {
|
||||
this.isDisabled = condition
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
label(label) {
|
||||
this.label = label
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
close(condition = true) {
|
||||
this.shouldClose = condition
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
openUrlInNewTab(condition = true) {
|
||||
this.shouldOpenUrlInNewTab = condition
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
size(size) {
|
||||
this.size = size
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
url(url) {
|
||||
this.url = url
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
view(view) {
|
||||
this.view = view
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
button() {
|
||||
this.view('filament-actions::button-action')
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
grouped() {
|
||||
this.view('filament-actions::grouped-action')
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
link() {
|
||||
this.view('filament-actions::link-action')
|
||||
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
class ActionGroup {
|
||||
constructor(actions) {
|
||||
this.actions(actions)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
actions(actions) {
|
||||
this.actions = actions.map((action) => action.grouped())
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
color(color) {
|
||||
this.color = color
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
icon(icon) {
|
||||
this.icon = icon
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
iconPosition(position) {
|
||||
this.iconPosition = position
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
label(label) {
|
||||
this.label = label
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
tooltip(tooltip) {
|
||||
this.tooltip = tooltip
|
||||
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
export { Action, ActionGroup, Notification }
|
||||
162
vendor/filament/notifications/resources/js/components/notification.js
vendored
Normal file
162
vendor/filament/notifications/resources/js/components/notification.js
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
import { once } from 'alpinejs/src/utils/once'
|
||||
|
||||
export default (Alpine) => {
|
||||
Alpine.data('notificationComponent', ({ notification }) => ({
|
||||
isShown: false,
|
||||
|
||||
computedStyle: null,
|
||||
|
||||
transitionDuration: null,
|
||||
|
||||
transitionEasing: null,
|
||||
|
||||
init: function () {
|
||||
this.computedStyle = window.getComputedStyle(this.$el)
|
||||
|
||||
this.transitionDuration =
|
||||
parseFloat(this.computedStyle.transitionDuration) * 1000
|
||||
|
||||
this.transitionEasing = this.computedStyle.transitionTimingFunction
|
||||
|
||||
this.configureTransitions()
|
||||
this.configureAnimations()
|
||||
|
||||
if (
|
||||
notification.duration &&
|
||||
notification.duration !== 'persistent'
|
||||
) {
|
||||
setTimeout(() => {
|
||||
if (!this.$el.matches(':hover')) {
|
||||
this.close()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
this.$el.addEventListener('mouseleave', () => this.close())
|
||||
}, notification.duration)
|
||||
}
|
||||
|
||||
this.isShown = true
|
||||
},
|
||||
|
||||
configureTransitions: function () {
|
||||
const display = this.computedStyle.display
|
||||
|
||||
const show = () => {
|
||||
Alpine.mutateDom(() => {
|
||||
this.$el.style.setProperty('display', display)
|
||||
this.$el.style.setProperty('visibility', 'visible')
|
||||
})
|
||||
this.$el._x_isShown = true
|
||||
}
|
||||
|
||||
const hide = () => {
|
||||
Alpine.mutateDom(() => {
|
||||
this.$el._x_isShown
|
||||
? this.$el.style.setProperty('visibility', 'hidden')
|
||||
: this.$el.style.setProperty('display', 'none')
|
||||
})
|
||||
}
|
||||
|
||||
const toggle = once(
|
||||
(value) => (value ? show() : hide()),
|
||||
(value) => {
|
||||
this.$el._x_toggleAndCascadeWithTransitions(
|
||||
this.$el,
|
||||
value,
|
||||
show,
|
||||
hide,
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
Alpine.effect(() => toggle(this.isShown))
|
||||
},
|
||||
|
||||
configureAnimations: function () {
|
||||
let animation
|
||||
|
||||
Livewire.hook(
|
||||
'commit',
|
||||
({ component, commit, succeed, fail, respond }) => {
|
||||
if (
|
||||
!component.snapshot.data
|
||||
.isFilamentNotificationsComponent
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
const getTop = () => this.$el.getBoundingClientRect().top
|
||||
const oldTop = getTop()
|
||||
|
||||
respond(() => {
|
||||
animation = () => {
|
||||
if (!this.isShown) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$el.animate(
|
||||
[
|
||||
{
|
||||
transform: `translateY(${
|
||||
oldTop - getTop()
|
||||
}px)`,
|
||||
},
|
||||
{ transform: 'translateY(0px)' },
|
||||
],
|
||||
{
|
||||
duration: this.transitionDuration,
|
||||
easing: this.transitionEasing,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
this.$el
|
||||
.getAnimations()
|
||||
.forEach((animation) => animation.finish())
|
||||
})
|
||||
|
||||
succeed(({ snapshot, effect }) => {
|
||||
animation()
|
||||
})
|
||||
},
|
||||
)
|
||||
},
|
||||
|
||||
close: function () {
|
||||
this.isShown = false
|
||||
|
||||
setTimeout(
|
||||
() =>
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('notificationClosed', {
|
||||
detail: {
|
||||
id: notification.id,
|
||||
},
|
||||
}),
|
||||
),
|
||||
this.transitionDuration,
|
||||
)
|
||||
},
|
||||
|
||||
markAsRead: function () {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('markedNotificationAsRead', {
|
||||
detail: {
|
||||
id: notification.id,
|
||||
},
|
||||
}),
|
||||
)
|
||||
},
|
||||
|
||||
markAsUnread: function () {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('markedNotificationAsUnread', {
|
||||
detail: {
|
||||
id: notification.id,
|
||||
},
|
||||
}),
|
||||
)
|
||||
},
|
||||
}))
|
||||
}
|
||||
14
vendor/filament/notifications/resources/js/index.js
vendored
Normal file
14
vendor/filament/notifications/resources/js/index.js
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import NotificationComponentAlpinePlugin from './components/notification'
|
||||
import {
|
||||
Action as NotificationAction,
|
||||
ActionGroup as NotificationActionGroup,
|
||||
Notification,
|
||||
} from './Notification'
|
||||
|
||||
window.FilamentNotificationAction = NotificationAction
|
||||
window.FilamentNotificationActionGroup = NotificationActionGroup
|
||||
window.FilamentNotification = Notification
|
||||
|
||||
document.addEventListener('alpine:init', () => {
|
||||
window.Alpine.plugin(NotificationComponentAlpinePlugin)
|
||||
})
|
||||
28
vendor/filament/notifications/resources/lang/ar/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/ar/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'التنبيهات',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'مسح',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'تحديد الكل كمقروء',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'لا توجد تنبيهات',
|
||||
'description' => 'يرجى التحقق مرة أخرى لاحقاً.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/az/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/az/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Bildirişlər',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Təmizlə',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Hamısını oxunub olaraq qeyd et',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Bildiriş yoxdur',
|
||||
'description' => 'Zəhmət olmazsa sonra yoxlayın',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/bg/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/bg/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Известия',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Изчисти',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Маркирай всички като прочетени',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Нямате известия',
|
||||
'description' => 'Моля проверете отново по-късно.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/bn/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/bn/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'বিজ্ঞপ্তি',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'পরিষ্কার',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'পড়া হয়েছে',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'কোন বিজ্ঞপ্তি নেই',
|
||||
'description' => 'পরে আবার চেষ্টা করুন',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/bs/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/bs/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Obavijesti',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Izbrišite sve',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Označi sve kao pročitano ',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Nema obavijesti',
|
||||
'description' => 'Molimo provjerite kasnije opet',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/ca/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/ca/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Notificacions',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Netejar',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Marcar tot com a llegit',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Sense notificacions',
|
||||
'description' => 'Si us plau, torna a comprovar-ho més tard.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/ckb/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/ckb/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'ئاگانامەکان',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'سرینەوەی هەموو',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'نیشانە کردنی هەموو بۆ خوێنراوە',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'هیچ ئاگانامەیەک نییە',
|
||||
'description' => 'تکایە دواتر سەردان بکە',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/cs/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/cs/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Moje aktualizace',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Odstranit',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Označit vše jako přečtené',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Nemáme pro vás žádné aktulizace',
|
||||
'description' => 'Zkuste to prosím později',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/cy/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/cy/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Hysbysiadau',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Clirio',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Nodi pob un fel ‘wedi darllen’',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Dim hysbysiad yma',
|
||||
'description' => 'Gwiriwch eto nes ymlaen',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/da/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/da/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Notifikationer',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Ryd',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Markér alle som læst',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Ingen notifikationer',
|
||||
'description' => 'Tjek venligst igen senere',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/de/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/de/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Benachrichtigungen',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Alle löschen',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Alle als gelesen markieren',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Keine Benachrichtigungen vorhanden',
|
||||
'description' => 'Bitte schauen Sie später erneut vorbei',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/el/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/el/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Ειδοποιήσεις',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Καθαρισμός',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Επισήμανση όλων ως αναγνωσμένων',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Δεν υπάρχουν νέες ειδοποιήσεις',
|
||||
'description' => 'Ελέγξτε ξανά αργότερα.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/en/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/en/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Notifications',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Clear',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Mark all as read',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'No notifications',
|
||||
'description' => 'Please check again later.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/es/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/es/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Notificaciones',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Borrar',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Marcar todas como leídas',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'No hay notificaciones',
|
||||
'description' => 'Por favor, compruebe más tarde',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/eu/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/eu/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Jakinarazpenak',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Ezabatu',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Denak irakurrita bezala markatu',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Ez dago jakinarazpenik',
|
||||
'description' => 'Mesedez, egiaztatu geroago',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/fa/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/fa/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'پیامها',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'پاک کردن',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'علامتگذاری همه به عنوان خواندهشده',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'شما پیامی ندارید',
|
||||
'description' => 'لطفا بعدا مراجعه کنید',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/fi/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/fi/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Ilmoitukset',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Tyhjennä',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Merkitse luetuiksi',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Ei ilmoituksia',
|
||||
'description' => 'Tarkista myöhemmin uudestaan',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/fr/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/fr/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Notifications',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Effacer',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Tout marquer comme lu',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Aucune notification',
|
||||
'description' => 'Veuillez revérifier ultérieurement',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/he/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/he/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'התראות',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'נקה',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'סמך הכל כנקרא',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'אין התראות',
|
||||
'description' => 'נסה שנית מאוחר יותר',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/hr/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/hr/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Obavijesti',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Očisti',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Označi sve kao pročitano',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Nema obavijesti',
|
||||
'description' => 'Molim provjerite ponovno kasnije.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/hu/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/hu/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Értesítések',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Törlés',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Összes olvasottnak jelölése',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Nincsenek értesítések',
|
||||
'description' => 'Kérjük, hogy nézz vissza később.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/id/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/id/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Notifikasi',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Bersihkan',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Tandai semua sudah dibaca',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Tidak ada notifikasi',
|
||||
'description' => 'Silakan periksa kembali nanti',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/it/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/it/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Notifiche',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Pulisci',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Imposta tutto come letto',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Nessuna notifica',
|
||||
'description' => 'Si prega di controllare più tardi',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/ja/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/ja/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => '通知',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'クリア',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'すべて既読にする',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => '通知はありません',
|
||||
'description' => 'のちほど確認してください',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/km/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/km/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'ដំណឹង',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'សំអាត',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'សម្គាល់ថាបានអានទាំងអស់ហើយ',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'គ្នានដំណឹង',
|
||||
'description' => 'សូមពិនិត្យម្តងទៀតនៅពេលក្រោយ.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/ko/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/ko/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => '알림',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => '전체 삭제',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => '모두 읽음으로 표시',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => '알림 없음',
|
||||
'description' => '나중에 다시 확인해 주세요.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/ku/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/ku/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'ئاگانامەکان',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'سرینەوەی هەموو',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'نیشانە کردنی هەموو بۆ خوێنراوە',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'هیچ ئاگانامەیەک نییە',
|
||||
'description' => 'تکایە دواتر سەردان بکە',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/lt/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/lt/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Pranešimai',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Išvalyti',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Pažymėti visus kaip perskaitytus',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Nėra pranešimų',
|
||||
'description' => 'Patikrinkite vėliau.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/lv/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/lv/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Paziņojumi',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Nodzēst',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Atzīmēt visus kā izlasītus',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Nav jaunu paziņojumu',
|
||||
'description' => 'Lūdzu, skatiet vēlāk',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/ms/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/ms/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Pemberitahuan',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Hapus',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Tandai semua sebagai dibaca',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Tiada pemberitahuan di sini',
|
||||
'description' => 'Sila semak semula kemudian',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/nl/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/nl/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Meldingen',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Wissen',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Alles als gelezen markeren',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Geen meldingen',
|
||||
'description' => 'Kijk later nog eens.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/no/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/no/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Varsler',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Tøm',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Merk alle som lest',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Ingen varsler',
|
||||
'description' => 'Vennligst sjekk senere.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/np/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/np/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'सूचनाहरू',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'खाली गर्नुहोस्',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'सबै पढेको रूपमा चिन्ह लगाउनुहोस्',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'कुनै सूचना छैन',
|
||||
'description' => 'कृपया पछि फेरि जाँच गर्नुहोस्।',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/pl/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/pl/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Powiadomienia',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Wyczyść',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Oznacz wszystkie jako przeczytane',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Brak powiadomień',
|
||||
'description' => 'Zajrzyj ponownie później',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/pt_BR/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/pt_BR/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Notificações',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Limpar',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Marcar tudo como lido',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Sem notificações',
|
||||
'description' => 'Por favor, verifique mais tarde.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/pt_PT/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/pt_PT/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Notificações',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Limpar',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Marcar tudo como lido',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Sem notificações',
|
||||
'description' => 'Por favor, verifique mais tarde.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/ro/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/ro/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Notificări',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Ștergere',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Marchează totul ca fiind citit',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Nu există notificări',
|
||||
'description' => 'Vă rugăm să verificați din nou mai târziu',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/ru/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/ru/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Уведомления',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Удалить',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Отметить как прочитанное',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Нет уведомлений',
|
||||
'description' => 'Пожалуйста, проверьте позже',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/sk/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/sk/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Notifikácie',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Odstrániť',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Označiť všetko ako prečítané',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Žiadne notifikácie',
|
||||
'description' => 'Skúste to prosím neskôr.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/sl/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/sl/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Obvestila',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Počisti',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Označi vse kot prebrano',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Ni obvestil',
|
||||
'description' => 'Prosimo, preverite ponovno kasneje.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/sq/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/sq/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Njoftimet',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Pastro',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Shënoni të gjitha si të lexuara',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Nuk ka njoftime',
|
||||
'description' => 'Ju lutemi kontrolloni përsëri më vonë.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/sv/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/sv/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Notiser',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Rensa',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Markera alla som lästa',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Inga notiser',
|
||||
'description' => 'Kolla igen lite senare.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/sw/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/sw/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Arifa',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Safisha',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Weka alama zote kama zimesomwa',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Hakuna arifa hapa',
|
||||
'description' => 'Tafadhali angalia tena baadae',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/th/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/th/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'การแจ้งเตือน',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'ล้าง',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'ทำเครื่องหมายทั้งหมดว่าอ่านแล้ว',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'ไม่มีการแจ้งเตือน',
|
||||
'description' => 'กรุณาตรวจสอบอีกครั้งในภายหลัง',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/tr/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/tr/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Bildirimler',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Temizle',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Tümünü okundu işaretle',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Bildirim yok',
|
||||
'description' => 'Lütfen sonra kontrol ediniz',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/uk/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/uk/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Сповіщення',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Видалити',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Позначити як прочитане',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Немає повідомлень',
|
||||
'description' => 'Будь ласка, перевірте пізніше',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/uz/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/uz/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Bildirishnomalar',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'O\'chirish',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'O\'qilgan deb belgilash',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Bildirishnomalar mavjud emas',
|
||||
'description' => 'Iltimos keyinroq tekshiring',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/vi/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/vi/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => 'Thông báo',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => 'Xóa',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => 'Đánh dấu tất cả là đã đọc',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Không có thông báo',
|
||||
'description' => 'Vui lòng kiểm tra lại sau.',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/zh_CN/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/zh_CN/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => '通知',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => '清除',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => '标记为已读',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => '没有通知',
|
||||
'description' => '请稍后再查看。',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
28
vendor/filament/notifications/resources/lang/zh_TW/database.php
vendored
Normal file
28
vendor/filament/notifications/resources/lang/zh_TW/database.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'modal' => [
|
||||
|
||||
'heading' => '通知',
|
||||
|
||||
'actions' => [
|
||||
|
||||
'clear' => [
|
||||
'label' => '清除',
|
||||
],
|
||||
|
||||
'mark_all_as_read' => [
|
||||
'label' => '標記為已讀',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => '沒有通知',
|
||||
'description' => '請稍後再查看。',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
11
vendor/filament/notifications/resources/views/components/actions.blade.php
vendored
Normal file
11
vendor/filament/notifications/resources/views/components/actions.blade.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
@props([
|
||||
'actions',
|
||||
])
|
||||
|
||||
<div
|
||||
{{ $attributes->class(['fi-no-notification-actions flex gap-x-3']) }}
|
||||
>
|
||||
@foreach ($actions as $action)
|
||||
{{ $action }}
|
||||
@endforeach
|
||||
</div>
|
||||
5
vendor/filament/notifications/resources/views/components/body.blade.php
vendored
Normal file
5
vendor/filament/notifications/resources/views/components/body.blade.php
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<div
|
||||
{{ $attributes->class(['fi-no-notification-body overflow-hidden break-words text-sm text-gray-500 dark:text-gray-400']) }}
|
||||
>
|
||||
{{ $slot }}
|
||||
</div>
|
||||
7
vendor/filament/notifications/resources/views/components/close-button.blade.php
vendored
Normal file
7
vendor/filament/notifications/resources/views/components/close-button.blade.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<x-filament::icon-button
|
||||
color="gray"
|
||||
icon="heroicon-m-x-mark"
|
||||
icon-alias="notifications::notification.close-button"
|
||||
x-on:click="close"
|
||||
class="fi-no-notification-close-btn"
|
||||
/>
|
||||
19
vendor/filament/notifications/resources/views/components/database/echo.blade.php
vendored
Normal file
19
vendor/filament/notifications/resources/views/components/database/echo.blade.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
@props([
|
||||
'channel',
|
||||
])
|
||||
|
||||
<div
|
||||
x-data="{}"
|
||||
x-init="
|
||||
window.addEventListener('EchoLoaded', () => {
|
||||
window.Echo.private(@js($channel)).listen('.database-notifications.sent', () => {
|
||||
setTimeout(() => $wire.call('$refresh'), 500)
|
||||
})
|
||||
})
|
||||
|
||||
if (window.Echo) {
|
||||
window.dispatchEvent(new CustomEvent('EchoLoaded'))
|
||||
}
|
||||
"
|
||||
{{ $attributes }}
|
||||
></div>
|
||||
27
vendor/filament/notifications/resources/views/components/database/modal/actions.blade.php
vendored
Normal file
27
vendor/filament/notifications/resources/views/components/database/modal/actions.blade.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
@props([
|
||||
'notifications',
|
||||
'unreadNotificationsCount',
|
||||
])
|
||||
|
||||
<div {{ $attributes->class('mt-2 flex gap-x-3') }}>
|
||||
@if ($unreadNotificationsCount)
|
||||
<x-filament::link
|
||||
color="primary"
|
||||
tabindex="-1"
|
||||
tag="button"
|
||||
wire:click="markAllNotificationsAsRead"
|
||||
>
|
||||
{{ __('filament-notifications::database.modal.actions.mark_all_as_read.label') }}
|
||||
</x-filament::link>
|
||||
@endif
|
||||
|
||||
<x-filament::link
|
||||
color="danger"
|
||||
tabindex="-1"
|
||||
tag="button"
|
||||
wire:click="clearNotifications"
|
||||
x-on:click="close()"
|
||||
>
|
||||
{{ __('filament-notifications::database.modal.actions.clear.label') }}
|
||||
</x-filament::link>
|
||||
</div>
|
||||
18
vendor/filament/notifications/resources/views/components/database/modal/heading.blade.php
vendored
Normal file
18
vendor/filament/notifications/resources/views/components/database/modal/heading.blade.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
@props([
|
||||
'unreadNotificationsCount',
|
||||
])
|
||||
|
||||
<x-filament::modal.heading>
|
||||
<span class="relative">
|
||||
{{ __('filament-notifications::database.modal.heading') }}
|
||||
|
||||
@if ($unreadNotificationsCount)
|
||||
<x-filament::badge
|
||||
size="xs"
|
||||
class="absolute -top-1 start-full ms-1 w-max"
|
||||
>
|
||||
{{ $unreadNotificationsCount }}
|
||||
</x-filament::badge>
|
||||
@endif
|
||||
</span>
|
||||
</x-filament::modal.heading>
|
||||
64
vendor/filament/notifications/resources/views/components/database/modal/index.blade.php
vendored
Normal file
64
vendor/filament/notifications/resources/views/components/database/modal/index.blade.php
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
@props([
|
||||
'notifications',
|
||||
'unreadNotificationsCount',
|
||||
])
|
||||
|
||||
@php
|
||||
use Filament\Support\Enums\Alignment;
|
||||
|
||||
$hasNotifications = $notifications->count();
|
||||
$isPaginated = $notifications instanceof \Illuminate\Contracts\Pagination\Paginator && $notifications->hasPages();
|
||||
@endphp
|
||||
|
||||
<x-filament::modal
|
||||
:alignment="$hasNotifications ? null : Alignment::Center"
|
||||
close-button
|
||||
:description="$hasNotifications ? null : __('filament-notifications::database.modal.empty.description')"
|
||||
:heading="$hasNotifications ? null : __('filament-notifications::database.modal.empty.heading')"
|
||||
:icon="$hasNotifications ? null : 'heroicon-o-bell-slash'"
|
||||
:icon-alias="$hasNotifications ? null : 'notifications::database.modal.empty-state'"
|
||||
:icon-color="$hasNotifications ? null : 'gray'"
|
||||
id="database-notifications"
|
||||
slide-over
|
||||
:sticky-header="$hasNotifications"
|
||||
width="md"
|
||||
>
|
||||
@if ($hasNotifications)
|
||||
<x-slot name="header">
|
||||
<div>
|
||||
<x-filament-notifications::database.modal.heading
|
||||
:unread-notifications-count="$unreadNotificationsCount"
|
||||
/>
|
||||
|
||||
<x-filament-notifications::database.modal.actions
|
||||
:notifications="$notifications"
|
||||
:unread-notifications-count="$unreadNotificationsCount"
|
||||
/>
|
||||
</div>
|
||||
</x-slot>
|
||||
|
||||
<div
|
||||
@class([
|
||||
'-mx-6 -mt-6 divide-y divide-gray-200 dark:divide-white/10',
|
||||
'-mb-6' => ! $isPaginated,
|
||||
'border-b border-gray-200 dark:border-white/10' => $isPaginated,
|
||||
])
|
||||
>
|
||||
@foreach ($notifications as $notification)
|
||||
<div
|
||||
@class([
|
||||
'relative before:absolute before:start-0 before:h-full before:w-0.5 before:bg-primary-600 dark:before:bg-primary-500' => $notification->unread(),
|
||||
])
|
||||
>
|
||||
{{ $this->getNotification($notification)->inline() }}
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@if ($isPaginated)
|
||||
<x-slot name="footer">
|
||||
<x-filament::pagination :paginator="$notifications" />
|
||||
</x-slot>
|
||||
@endif
|
||||
@endif
|
||||
</x-filament::modal>
|
||||
7
vendor/filament/notifications/resources/views/components/database/trigger.blade.php
vendored
Normal file
7
vendor/filament/notifications/resources/views/components/database/trigger.blade.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<div
|
||||
x-data="{}"
|
||||
x-on:click="$dispatch('open-modal', { id: 'database-notifications' })"
|
||||
{{ $attributes->class(['inline-block']) }}
|
||||
>
|
||||
{{ $slot }}
|
||||
</div>
|
||||
5
vendor/filament/notifications/resources/views/components/date.blade.php
vendored
Normal file
5
vendor/filament/notifications/resources/views/components/date.blade.php
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<time
|
||||
{{ $attributes->class(['fi-no-notification-date text-sm text-gray-500 dark:text-gray-400']) }}
|
||||
>
|
||||
{{ $slot }}
|
||||
</time>
|
||||
19
vendor/filament/notifications/resources/views/components/echo.blade.php
vendored
Normal file
19
vendor/filament/notifications/resources/views/components/echo.blade.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
@props([
|
||||
'channel',
|
||||
])
|
||||
|
||||
<div
|
||||
x-data="{}"
|
||||
x-init="
|
||||
window.addEventListener('EchoLoaded', () => {
|
||||
window.Echo.private(@js($channel)).notification((notification) => {
|
||||
setTimeout(() => $wire.handleBroadcastNotification(notification), 500)
|
||||
})
|
||||
})
|
||||
|
||||
if (window.Echo) {
|
||||
window.dispatchEvent(new CustomEvent('EchoLoaded'))
|
||||
}
|
||||
"
|
||||
{{ $attributes }}
|
||||
></div>
|
||||
37
vendor/filament/notifications/resources/views/components/icon.blade.php
vendored
Normal file
37
vendor/filament/notifications/resources/views/components/icon.blade.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
@php
|
||||
use Filament\Support\Enums\IconSize;
|
||||
@endphp
|
||||
|
||||
@props([
|
||||
'color' => 'gray',
|
||||
'icon',
|
||||
'size' => IconSize::Large,
|
||||
])
|
||||
|
||||
<x-filament::icon
|
||||
:icon="$icon"
|
||||
:attributes="
|
||||
$attributes
|
||||
->class([
|
||||
'fi-no-notification-icon',
|
||||
match ($color) {
|
||||
'gray' => 'text-gray-400',
|
||||
default => 'fi-color-custom text-custom-400',
|
||||
},
|
||||
is_string($color) ? 'fi-color-' . $color : null,
|
||||
match ($size) {
|
||||
IconSize::Small, 'sm' => 'h-4 w-4',
|
||||
IconSize::Medium, 'md' => 'h-5 w-5',
|
||||
IconSize::Large, 'lg' => 'h-6 w-6',
|
||||
default => $size,
|
||||
},
|
||||
])
|
||||
->style([
|
||||
\Filament\Support\get_color_css_variables(
|
||||
$color,
|
||||
shades: [400],
|
||||
alias: 'notifications::notification.icon',
|
||||
),
|
||||
])
|
||||
"
|
||||
/>
|
||||
16
vendor/filament/notifications/resources/views/components/notification.blade.php
vendored
Normal file
16
vendor/filament/notifications/resources/views/components/notification.blade.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
@props([
|
||||
'notification',
|
||||
])
|
||||
|
||||
<div
|
||||
x-data="notificationComponent({ notification: @js($notification) })"
|
||||
{{
|
||||
$attributes
|
||||
->merge([
|
||||
'wire:key' => "{$this->getId()}.notifications.{$notification->getId()}",
|
||||
], escape: false)
|
||||
->class(['pointer-events-auto invisible'])
|
||||
}}
|
||||
>
|
||||
{{ $slot }}
|
||||
</div>
|
||||
5
vendor/filament/notifications/resources/views/components/title.blade.php
vendored
Normal file
5
vendor/filament/notifications/resources/views/components/title.blade.php
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<h3
|
||||
{{ $attributes->class(['fi-no-notification-title text-sm font-medium text-gray-950 dark:text-white']) }}
|
||||
>
|
||||
{{ $slot }}
|
||||
</h3>
|
||||
28
vendor/filament/notifications/resources/views/database-notifications.blade.php
vendored
Normal file
28
vendor/filament/notifications/resources/views/database-notifications.blade.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
@php
|
||||
$notifications = $this->getNotifications();
|
||||
$unreadNotificationsCount = $this->getUnreadNotificationsCount();
|
||||
@endphp
|
||||
|
||||
<div
|
||||
@if ($pollingInterval = $this->getPollingInterval())
|
||||
wire:poll.{{ $pollingInterval }}
|
||||
@endif
|
||||
class="flex"
|
||||
>
|
||||
@if ($trigger = $this->getTrigger())
|
||||
<x-filament-notifications::database.trigger>
|
||||
{{ $trigger->with(['unreadNotificationsCount' => $unreadNotificationsCount]) }}
|
||||
</x-filament-notifications::database.trigger>
|
||||
@endif
|
||||
|
||||
<x-filament-notifications::database.modal
|
||||
:notifications="$notifications"
|
||||
:unread-notifications-count="$unreadNotificationsCount"
|
||||
/>
|
||||
|
||||
@if ($broadcastChannel = $this->getBroadcastChannel())
|
||||
<x-filament-notifications::database.echo
|
||||
:channel="$broadcastChannel"
|
||||
/>
|
||||
@endif
|
||||
</div>
|
||||
116
vendor/filament/notifications/resources/views/notification.blade.php
vendored
Normal file
116
vendor/filament/notifications/resources/views/notification.blade.php
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
@php
|
||||
use Filament\Notifications\Livewire\Notifications;
|
||||
use Filament\Support\Enums\Alignment;
|
||||
use Filament\Support\Enums\VerticalAlignment;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
$color = $getColor() ?? 'gray';
|
||||
$isInline = $isInline();
|
||||
$status = $getStatus();
|
||||
$title = $getTitle();
|
||||
$hasTitle = filled($title);
|
||||
$date = $getDate();
|
||||
$hasDate = filled($date);
|
||||
$body = $getBody();
|
||||
$hasBody = filled($body);
|
||||
@endphp
|
||||
|
||||
<x-filament-notifications::notification
|
||||
:notification="$notification"
|
||||
:x-transition:enter-start="
|
||||
Arr::toCssClasses([
|
||||
'opacity-0',
|
||||
($this instanceof Notifications)
|
||||
? match (static::$alignment) {
|
||||
Alignment::Start, Alignment::Left => '-translate-x-12',
|
||||
Alignment::End, Alignment::Right => 'translate-x-12',
|
||||
Alignment::Center => match (static::$verticalAlignment) {
|
||||
VerticalAlignment::Start => '-translate-y-12',
|
||||
VerticalAlignment::End => 'translate-y-12',
|
||||
default => null,
|
||||
},
|
||||
default => null,
|
||||
}
|
||||
: null,
|
||||
])
|
||||
"
|
||||
:x-transition:leave-end="
|
||||
Arr::toCssClasses([
|
||||
'opacity-0',
|
||||
'scale-95' => ! $isInline,
|
||||
])
|
||||
"
|
||||
@class([
|
||||
'fi-no-notification w-full overflow-hidden transition duration-300',
|
||||
...match ($isInline) {
|
||||
true => [
|
||||
'fi-inline',
|
||||
],
|
||||
false => [
|
||||
'max-w-sm rounded-xl bg-white shadow-lg ring-1 dark:bg-gray-900',
|
||||
match ($color) {
|
||||
'gray' => 'ring-gray-950/5 dark:ring-white/10',
|
||||
default => 'fi-color-custom ring-custom-600/20 dark:ring-custom-400/30',
|
||||
},
|
||||
is_string($color) ? 'fi-color-' . $color : null,
|
||||
'fi-status-' . $status => $status,
|
||||
],
|
||||
},
|
||||
])
|
||||
@style([
|
||||
\Filament\Support\get_color_css_variables(
|
||||
$color,
|
||||
shades: [50, 400, 600],
|
||||
alias: 'notifications::notification',
|
||||
) => ! ($isInline || $color === 'gray'),
|
||||
])
|
||||
>
|
||||
<div
|
||||
@class([
|
||||
'flex w-full gap-3 p-4',
|
||||
match ($color) {
|
||||
'gray' => null,
|
||||
default => 'bg-custom-50 dark:bg-custom-400/10',
|
||||
},
|
||||
])
|
||||
>
|
||||
@if ($icon = $getIcon())
|
||||
<x-filament-notifications::icon
|
||||
:color="$getIconColor()"
|
||||
:icon="$icon"
|
||||
:size="$getIconSize()"
|
||||
/>
|
||||
@endif
|
||||
|
||||
<div class="mt-0.5 grid flex-1">
|
||||
@if ($hasTitle)
|
||||
<x-filament-notifications::title>
|
||||
{{ str($title)->sanitizeHtml()->toHtmlString() }}
|
||||
</x-filament-notifications::title>
|
||||
@endif
|
||||
|
||||
@if ($hasDate)
|
||||
<x-filament-notifications::date @class(['mt-1' => $hasTitle])>
|
||||
{{ $date }}
|
||||
</x-filament-notifications::date>
|
||||
@endif
|
||||
|
||||
@if ($hasBody)
|
||||
<x-filament-notifications::body
|
||||
@class(['mt-1' => $hasTitle || $hasDate])
|
||||
>
|
||||
{{ str($body)->sanitizeHtml()->toHtmlString() }}
|
||||
</x-filament-notifications::body>
|
||||
@endif
|
||||
|
||||
@if ($actions = $getActions())
|
||||
<x-filament-notifications::actions
|
||||
:actions="$actions"
|
||||
@class(['mt-3' => $hasTitle || $hasDate || $hasBody])
|
||||
/>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<x-filament-notifications::close-button />
|
||||
</div>
|
||||
</x-filament-notifications::notification>
|
||||
32
vendor/filament/notifications/resources/views/notifications.blade.php
vendored
Normal file
32
vendor/filament/notifications/resources/views/notifications.blade.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
@php
|
||||
use Filament\Support\Enums\Alignment;
|
||||
use Filament\Support\Enums\VerticalAlignment;
|
||||
@endphp
|
||||
|
||||
<div>
|
||||
<div
|
||||
@class([
|
||||
'fi-no pointer-events-none fixed inset-4 z-50 mx-auto flex gap-3',
|
||||
match (static::$alignment) {
|
||||
Alignment::Start, Alignment::Left => 'items-start',
|
||||
Alignment::Center => 'items-center',
|
||||
Alignment::End, Alignment::Right => 'items-end',
|
||||
default => null,
|
||||
},
|
||||
match (static::$verticalAlignment) {
|
||||
VerticalAlignment::Start => 'flex-col-reverse justify-end',
|
||||
VerticalAlignment::End => 'flex-col justify-end',
|
||||
VerticalAlignment::Center => 'flex-col justify-center',
|
||||
},
|
||||
])
|
||||
role="status"
|
||||
>
|
||||
@foreach ($notifications as $notification)
|
||||
{{ $notification }}
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@if ($broadcastChannel = $this->getBroadcastChannel())
|
||||
<x-filament-notifications::echo :channel="$broadcastChannel" />
|
||||
@endif
|
||||
</div>
|
||||
147
vendor/filament/notifications/src/Actions/Action.php
vendored
Normal file
147
vendor/filament/notifications/src/Actions/Action.php
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Actions;
|
||||
|
||||
use Closure;
|
||||
use Filament\Actions\StaticAction;
|
||||
use Filament\Support\Enums\ActionSize;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Action extends StaticAction implements Arrayable
|
||||
{
|
||||
protected string $viewIdentifier = 'action';
|
||||
|
||||
protected bool | Closure $shouldMarkAsRead = false;
|
||||
|
||||
protected bool | Closure $shouldMarkAsUnread = false;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->defaultView(static::LINK_VIEW);
|
||||
|
||||
$this->defaultSize(ActionSize::Small);
|
||||
}
|
||||
|
||||
public function markAsRead(bool | Closure $condition = true): static
|
||||
{
|
||||
$this->shouldMarkAsRead = $condition;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function markAsUnread(bool | Closure $condition = true): static
|
||||
{
|
||||
$this->shouldMarkAsUnread = $condition;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->getName(),
|
||||
'color' => $this->getColor(),
|
||||
'event' => $this->getEvent(),
|
||||
'eventData' => $this->getEventData(),
|
||||
'dispatchDirection' => $this->getDispatchDirection(),
|
||||
'dispatchToComponent' => $this->getDispatchToComponent(),
|
||||
'extraAttributes' => $this->getExtraAttributes(),
|
||||
'icon' => $this->getIcon(),
|
||||
'iconPosition' => $this->getIconPosition(),
|
||||
'iconSize' => $this->getIconSize(),
|
||||
'isOutlined' => $this->isOutlined(),
|
||||
'isDisabled' => $this->isDisabled(),
|
||||
'label' => $this->getLabel(),
|
||||
'shouldClose' => $this->shouldClose(),
|
||||
'shouldMarkAsRead' => $this->shouldMarkAsRead(),
|
||||
'shouldMarkAsUnread' => $this->shouldMarkAsUnread(),
|
||||
'shouldOpenUrlInNewTab' => $this->shouldOpenUrlInNewTab(),
|
||||
'size' => $this->getSize(),
|
||||
'tooltip' => $this->getTooltip(),
|
||||
'url' => $this->getUrl(),
|
||||
'view' => $this->getView(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $data
|
||||
*/
|
||||
public static function fromArray(array $data): static
|
||||
{
|
||||
$static = static::make($data['name']);
|
||||
|
||||
$view = $data['view'] ?? null;
|
||||
|
||||
if (filled($view) && ($static->getView() !== $view) && static::isViewSafe($view)) {
|
||||
$static->view($view);
|
||||
}
|
||||
|
||||
if (filled($size = $data['size'] ?? null)) {
|
||||
$static->size($size);
|
||||
}
|
||||
|
||||
$static->close($data['shouldClose'] ?? false);
|
||||
$static->color($data['color'] ?? null);
|
||||
$static->disabled($data['isDisabled'] ?? false);
|
||||
|
||||
match ($data['dispatchDirection'] ?? null) {
|
||||
'self' => $static->dispatchSelf($data['event'] ?? null, $data['eventData'] ?? []),
|
||||
'to' => $static->dispatchTo($data['dispatchToComponent'] ?? null, $data['event'] ?? null, $data['eventData'] ?? []),
|
||||
default => $static->dispatch($data['event'] ?? null, $data['eventData'] ?? [])
|
||||
};
|
||||
|
||||
$static->extraAttributes($data['extraAttributes'] ?? []);
|
||||
$static->icon($data['icon'] ?? null);
|
||||
$static->iconPosition($data['iconPosition'] ?? null);
|
||||
$static->iconSize($data['iconSize'] ?? null);
|
||||
$static->label($data['label'] ?? null);
|
||||
$static->markAsRead($data['shouldMarkAsRead'] ?? false);
|
||||
$static->markAsUnread($data['shouldMarkAsUnread'] ?? false);
|
||||
$static->outlined($data['isOutlined'] ?? false);
|
||||
$static->url($data['url'] ?? null, $data['shouldOpenUrlInNewTab'] ?? false);
|
||||
$static->tooltip($data['tooltip'] ?? null);
|
||||
|
||||
return $static;
|
||||
}
|
||||
|
||||
public function getAlpineClickHandler(): ?string
|
||||
{
|
||||
if (filled($handler = parent::getAlpineClickHandler())) {
|
||||
return $handler;
|
||||
}
|
||||
|
||||
if ($this->shouldMarkAsRead()) {
|
||||
return 'markAsRead()';
|
||||
}
|
||||
|
||||
if ($this->shouldMarkAsUnread()) {
|
||||
return 'markAsUnread()';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param view-string $view
|
||||
*/
|
||||
protected static function isViewSafe(string $view): bool
|
||||
{
|
||||
return Str::startsWith($view, 'filament-actions::');
|
||||
}
|
||||
|
||||
public function shouldMarkAsRead(): bool
|
||||
{
|
||||
return (bool) $this->evaluate($this->shouldMarkAsRead);
|
||||
}
|
||||
|
||||
public function shouldMarkAsUnread(): bool
|
||||
{
|
||||
return (bool) $this->evaluate($this->shouldMarkAsUnread);
|
||||
}
|
||||
}
|
||||
88
vendor/filament/notifications/src/Actions/ActionGroup.php
vendored
Normal file
88
vendor/filament/notifications/src/Actions/ActionGroup.php
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Actions;
|
||||
|
||||
use Filament\Actions\ActionGroup as BaseActionGroup;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @property array<Action> $actions
|
||||
*/
|
||||
class ActionGroup extends BaseActionGroup implements Arrayable
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'actions' => collect($this->getActions())->toArray(),
|
||||
'color' => $this->getColor(),
|
||||
'dropdownMaxHeight' => $this->getDropdownMaxHeight(),
|
||||
'dropdownOffset' => $this->getDropdownOffset(),
|
||||
'dropdownPlacement' => $this->getDropdownPlacement(),
|
||||
'dropdownWidth' => $this->getDropdownWidth(),
|
||||
'extraAttributes' => $this->getExtraAttributes(),
|
||||
'hasDropdown' => $this->hasDropdown(),
|
||||
'icon' => $this->getIcon(),
|
||||
'iconPosition' => $this->getIconPosition(),
|
||||
'iconSize' => $this->getIconSize(),
|
||||
'isOutlined' => $this->isOutlined(),
|
||||
'label' => $this->getLabel(),
|
||||
'size' => $this->getSize(),
|
||||
'tooltip' => $this->getTooltip(),
|
||||
'view' => $this->getView(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $data
|
||||
*/
|
||||
public static function fromArray(array $data): static
|
||||
{
|
||||
$static = static::make(
|
||||
array_map(
|
||||
fn (array $action): Action | ActionGroup => match (array_key_exists('actions', $action)) {
|
||||
true => ActionGroup::fromArray($action),
|
||||
false => Action::fromArray($action),
|
||||
},
|
||||
$data['actions'] ?? [],
|
||||
),
|
||||
);
|
||||
|
||||
$view = $data['view'] ?? null;
|
||||
|
||||
if (filled($view) && ($static->getView() !== $view) && static::isViewSafe($view)) {
|
||||
$static->view($view);
|
||||
}
|
||||
|
||||
if (filled($size = $data['size'] ?? null)) {
|
||||
$static->size($size);
|
||||
}
|
||||
|
||||
$static->color($data['color'] ?? null);
|
||||
$static->dropdown($data['hasDropdown'] ?? false);
|
||||
$static->dropdownMaxHeight($data['dropdownMaxHeight'] ?? null);
|
||||
$static->dropdownOffset($data['dropdownOffset'] ?? null);
|
||||
$static->dropdownPlacement($data['dropdownPlacement'] ?? null);
|
||||
$static->dropdownWidth($data['dropdownWidth'] ?? null);
|
||||
$static->extraAttributes($data['extraAttributes'] ?? []);
|
||||
$static->icon($data['icon'] ?? null);
|
||||
$static->iconPosition($data['iconPosition'] ?? null);
|
||||
$static->iconSize($data['iconSize'] ?? null);
|
||||
$static->label($data['label'] ?? null);
|
||||
$static->outlined($data['isOutlined'] ?? null);
|
||||
$static->tooltip($data['tooltip'] ?? null);
|
||||
|
||||
return $static;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param view-string $view
|
||||
*/
|
||||
protected static function isViewSafe(string $view): bool
|
||||
{
|
||||
return Str::startsWith($view, 'filament-actions::');
|
||||
}
|
||||
}
|
||||
39
vendor/filament/notifications/src/BroadcastNotification.php
vendored
Normal file
39
vendor/filament/notifications/src/BroadcastNotification.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Notifications\Messages\BroadcastMessage;
|
||||
use Illuminate\Notifications\Notification as BaseNotification;
|
||||
|
||||
class BroadcastNotification extends BaseNotification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $data
|
||||
*/
|
||||
public function __construct(
|
||||
public array $data,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $notifiable
|
||||
* @return array<string>
|
||||
*/
|
||||
public function via($notifiable): array
|
||||
{
|
||||
return ['broadcast'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $notifiable
|
||||
*/
|
||||
public function toBroadcast($notifiable): BroadcastMessage
|
||||
{
|
||||
return new BroadcastMessage($this->data);
|
||||
}
|
||||
}
|
||||
35
vendor/filament/notifications/src/Collection.php
vendored
Normal file
35
vendor/filament/notifications/src/Collection.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications;
|
||||
|
||||
use Illuminate\Support\Collection as BaseCollection;
|
||||
use Livewire\Wireable;
|
||||
|
||||
class Collection extends BaseCollection implements Wireable
|
||||
{
|
||||
/**
|
||||
* @param array<array<string, mixed>> $items
|
||||
*/
|
||||
final public function __construct($items = [])
|
||||
{
|
||||
parent::__construct($items);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<array<string, mixed>>
|
||||
*/
|
||||
public function toLivewire(): array
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<array<string, mixed>> $value
|
||||
*/
|
||||
public static function fromLivewire($value): static
|
||||
{
|
||||
return app(static::class, ['items' => $value])->transform(
|
||||
fn (array $notification): Notification => Notification::fromArray($notification),
|
||||
);
|
||||
}
|
||||
}
|
||||
20
vendor/filament/notifications/src/Concerns/CanBeInline.php
vendored
Normal file
20
vendor/filament/notifications/src/Concerns/CanBeInline.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Concerns;
|
||||
|
||||
trait CanBeInline
|
||||
{
|
||||
protected bool $isInline = false;
|
||||
|
||||
public function inline(bool $condition = true): static
|
||||
{
|
||||
$this->isInline = $condition;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isInline(): bool
|
||||
{
|
||||
return $this->isInline;
|
||||
}
|
||||
}
|
||||
34
vendor/filament/notifications/src/Concerns/HasActions.php
vendored
Normal file
34
vendor/filament/notifications/src/Concerns/HasActions.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Concerns;
|
||||
|
||||
use Closure;
|
||||
use Filament\Notifications\Actions\Action;
|
||||
use Filament\Notifications\Actions\ActionGroup;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
trait HasActions
|
||||
{
|
||||
/**
|
||||
* @var array<Action | ActionGroup> | ActionGroup | Closure
|
||||
*/
|
||||
protected array | ActionGroup | Closure $actions = [];
|
||||
|
||||
/**
|
||||
* @param array<Action | ActionGroup> | ActionGroup | Closure $actions
|
||||
*/
|
||||
public function actions(array | ActionGroup | Closure $actions): static
|
||||
{
|
||||
$this->actions = $actions;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<Action | ActionGroup>
|
||||
*/
|
||||
public function getActions(): array
|
||||
{
|
||||
return Arr::wrap($this->evaluate($this->actions));
|
||||
}
|
||||
}
|
||||
22
vendor/filament/notifications/src/Concerns/HasBody.php
vendored
Normal file
22
vendor/filament/notifications/src/Concerns/HasBody.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Concerns;
|
||||
|
||||
use Closure;
|
||||
|
||||
trait HasBody
|
||||
{
|
||||
protected string | Closure | null $body = null;
|
||||
|
||||
public function body(string | Closure | null $body): static
|
||||
{
|
||||
$this->body = $body;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBody(): ?string
|
||||
{
|
||||
return $this->evaluate($this->body);
|
||||
}
|
||||
}
|
||||
22
vendor/filament/notifications/src/Concerns/HasDate.php
vendored
Normal file
22
vendor/filament/notifications/src/Concerns/HasDate.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Concerns;
|
||||
|
||||
use Closure;
|
||||
|
||||
trait HasDate
|
||||
{
|
||||
protected string | Closure | null $date = null;
|
||||
|
||||
public function date(string | Closure | null $date): static
|
||||
{
|
||||
$this->date = $date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDate(): ?string
|
||||
{
|
||||
return $this->evaluate($this->date);
|
||||
}
|
||||
}
|
||||
36
vendor/filament/notifications/src/Concerns/HasDuration.php
vendored
Normal file
36
vendor/filament/notifications/src/Concerns/HasDuration.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Concerns;
|
||||
|
||||
use Closure;
|
||||
|
||||
trait HasDuration
|
||||
{
|
||||
protected int | string | Closure $duration = 6000;
|
||||
|
||||
public function duration(int | string | Closure | null $duration): static
|
||||
{
|
||||
$this->duration = $duration ?? 'persistent';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDuration(): int | string
|
||||
{
|
||||
return $this->evaluate($this->duration) ?? 'persistent';
|
||||
}
|
||||
|
||||
public function seconds(float $seconds): static
|
||||
{
|
||||
$this->duration((int) ($seconds * 1000));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function persistent(): static
|
||||
{
|
||||
$this->duration('persistent');
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
24
vendor/filament/notifications/src/Concerns/HasIcon.php
vendored
Normal file
24
vendor/filament/notifications/src/Concerns/HasIcon.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Concerns;
|
||||
|
||||
use Filament\Support\Concerns\HasIcon as BaseTrait;
|
||||
use Filament\Support\Facades\FilamentIcon;
|
||||
|
||||
trait HasIcon
|
||||
{
|
||||
use BaseTrait {
|
||||
getIcon as baseGetIcon;
|
||||
}
|
||||
|
||||
public function getIcon(): ?string
|
||||
{
|
||||
return $this->baseGetIcon() ?? match ($this->getStatus()) {
|
||||
'danger' => FilamentIcon::resolve('notifications::notification.danger') ?? 'heroicon-o-x-circle',
|
||||
'info' => FilamentIcon::resolve('notifications::notification.info') ?? 'heroicon-o-information-circle',
|
||||
'success' => FilamentIcon::resolve('notifications::notification.success') ?? 'heroicon-o-check-circle',
|
||||
'warning' => FilamentIcon::resolve('notifications::notification.warning') ?? 'heroicon-o-exclamation-circle',
|
||||
default => null,
|
||||
};
|
||||
}
|
||||
}
|
||||
20
vendor/filament/notifications/src/Concerns/HasIconColor.php
vendored
Normal file
20
vendor/filament/notifications/src/Concerns/HasIconColor.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Concerns;
|
||||
|
||||
use Filament\Support\Concerns\HasIconColor as BaseTrait;
|
||||
|
||||
trait HasIconColor
|
||||
{
|
||||
use BaseTrait {
|
||||
getIconColor as baseGetIconColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null
|
||||
*/
|
||||
public function getIconColor(): string | array | null
|
||||
{
|
||||
return $this->baseGetIconColor() ?? $this->getStatus();
|
||||
}
|
||||
}
|
||||
20
vendor/filament/notifications/src/Concerns/HasId.php
vendored
Normal file
20
vendor/filament/notifications/src/Concerns/HasId.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Concerns;
|
||||
|
||||
trait HasId
|
||||
{
|
||||
protected string $id;
|
||||
|
||||
public function id(string $id): static
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
42
vendor/filament/notifications/src/Concerns/HasStatus.php
vendored
Normal file
42
vendor/filament/notifications/src/Concerns/HasStatus.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Concerns;
|
||||
|
||||
use Closure;
|
||||
|
||||
trait HasStatus
|
||||
{
|
||||
protected string | Closure | null $status = null;
|
||||
|
||||
public function status(string | Closure | null $status): static
|
||||
{
|
||||
$this->status = $status;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStatus(): ?string
|
||||
{
|
||||
return $this->evaluate($this->status);
|
||||
}
|
||||
|
||||
public function danger(): static
|
||||
{
|
||||
return $this->status('danger');
|
||||
}
|
||||
|
||||
public function info(): static
|
||||
{
|
||||
return $this->status('info');
|
||||
}
|
||||
|
||||
public function success(): static
|
||||
{
|
||||
return $this->status('success');
|
||||
}
|
||||
|
||||
public function warning(): static
|
||||
{
|
||||
return $this->status('warning');
|
||||
}
|
||||
}
|
||||
22
vendor/filament/notifications/src/Concerns/HasTitle.php
vendored
Normal file
22
vendor/filament/notifications/src/Concerns/HasTitle.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Concerns;
|
||||
|
||||
use Closure;
|
||||
|
||||
trait HasTitle
|
||||
{
|
||||
protected string | Closure | null $title = null;
|
||||
|
||||
public function title(string | Closure | null $title): static
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTitle(): ?string
|
||||
{
|
||||
return $this->evaluate($this->title);
|
||||
}
|
||||
}
|
||||
48
vendor/filament/notifications/src/DatabaseNotification.php
vendored
Normal file
48
vendor/filament/notifications/src/DatabaseNotification.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Notifications\Notification as BaseNotification;
|
||||
|
||||
class DatabaseNotification extends BaseNotification implements Arrayable, ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $data
|
||||
*/
|
||||
public function __construct(
|
||||
public array $data,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $notifiable
|
||||
* @return array<string>
|
||||
*/
|
||||
public function via($notifiable): array
|
||||
{
|
||||
return ['database'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $notifiable
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toDatabase($notifiable): array
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
41
vendor/filament/notifications/src/Events/DatabaseNotificationsSent.php
vendored
Normal file
41
vendor/filament/notifications/src/Events/DatabaseNotificationsSent.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Events;
|
||||
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class DatabaseNotificationsSent implements ShouldBroadcast
|
||||
{
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
public Model | Authenticatable $user;
|
||||
|
||||
public function __construct(Model | Authenticatable $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
public function broadcastOn(): string
|
||||
{
|
||||
if (method_exists($this->user, 'receivesBroadcastNotificationsOn')) {
|
||||
return new PrivateChannel($this->user->receivesBroadcastNotificationsOn());
|
||||
}
|
||||
|
||||
$userClass = str_replace('\\', '.', $this->user::class);
|
||||
|
||||
return new PrivateChannel("{$userClass}.{$this->user->getKey()}");
|
||||
}
|
||||
|
||||
public function broadcastAs(): string
|
||||
{
|
||||
return 'database-notifications.sent';
|
||||
}
|
||||
}
|
||||
178
vendor/filament/notifications/src/Livewire/DatabaseNotifications.php
vendored
Normal file
178
vendor/filament/notifications/src/Livewire/DatabaseNotifications.php
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Livewire;
|
||||
|
||||
use Carbon\CarbonInterface;
|
||||
use Filament\Notifications\Notification;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Contracts\Pagination\Paginator;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Illuminate\Notifications\DatabaseNotification;
|
||||
use Illuminate\Notifications\DatabaseNotificationCollection;
|
||||
use Livewire\Attributes\On;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithPagination;
|
||||
|
||||
class DatabaseNotifications extends Component
|
||||
{
|
||||
use WithPagination;
|
||||
|
||||
public static bool $isPaginated = true;
|
||||
|
||||
public static ?string $trigger = null;
|
||||
|
||||
public static ?string $pollingInterval = '30s';
|
||||
|
||||
public static ?string $authGuard = null;
|
||||
|
||||
#[On('databaseNotificationsSent')]
|
||||
public function refresh(): void
|
||||
{
|
||||
}
|
||||
|
||||
#[On('notificationClosed')]
|
||||
public function removeNotification(string $id): void
|
||||
{
|
||||
$this->getNotificationsQuery()
|
||||
->where('id', $id)
|
||||
->delete();
|
||||
}
|
||||
|
||||
#[On('markedNotificationAsRead')]
|
||||
public function markNotificationAsRead(string $id): void
|
||||
{
|
||||
$this->getNotificationsQuery()
|
||||
->where('id', $id)
|
||||
->update(['read_at' => now()]);
|
||||
}
|
||||
|
||||
#[On('markedNotificationAsUnread')]
|
||||
public function markNotificationAsUnread(string $id): void
|
||||
{
|
||||
$this->getNotificationsQuery()
|
||||
->where('id', $id)
|
||||
->update(['read_at' => null]);
|
||||
}
|
||||
|
||||
public function clearNotifications(): void
|
||||
{
|
||||
$this->getNotificationsQuery()->delete();
|
||||
}
|
||||
|
||||
public function markAllNotificationsAsRead(): void
|
||||
{
|
||||
$this->getUnreadNotificationsQuery()->update(['read_at' => now()]);
|
||||
}
|
||||
|
||||
public function getNotifications(): DatabaseNotificationCollection | Paginator
|
||||
{
|
||||
if (! $this->isPaginated()) {
|
||||
/** @phpstan-ignore-next-line */
|
||||
return $this->getNotificationsQuery()->get();
|
||||
}
|
||||
|
||||
return $this->getNotificationsQuery()->simplePaginate(50, pageName: 'database-notifications-page');
|
||||
}
|
||||
|
||||
public function isPaginated(): bool
|
||||
{
|
||||
return static::$isPaginated;
|
||||
}
|
||||
|
||||
public function getNotificationsQuery(): Builder | Relation
|
||||
{
|
||||
/** @phpstan-ignore-next-line */
|
||||
return $this->getUser()->notifications()->where('data->format', 'filament');
|
||||
}
|
||||
|
||||
public function getUnreadNotificationsQuery(): Builder | Relation
|
||||
{
|
||||
/** @phpstan-ignore-next-line */
|
||||
return $this->getNotificationsQuery()->unread();
|
||||
}
|
||||
|
||||
public function getUnreadNotificationsCount(): int
|
||||
{
|
||||
return $this->getUnreadNotificationsQuery()->count();
|
||||
}
|
||||
|
||||
public function getPollingInterval(): ?string
|
||||
{
|
||||
return static::$pollingInterval;
|
||||
}
|
||||
|
||||
public function getTrigger(): ?View
|
||||
{
|
||||
$viewPath = static::$trigger;
|
||||
|
||||
if (blank($viewPath)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return view($viewPath);
|
||||
}
|
||||
|
||||
public function getUser(): Model | Authenticatable | null
|
||||
{
|
||||
return auth(static::$authGuard)->user();
|
||||
}
|
||||
|
||||
public function getBroadcastChannel(): ?string
|
||||
{
|
||||
$user = $this->getUser();
|
||||
|
||||
if (! $user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (method_exists($user, 'receivesBroadcastNotificationsOn')) {
|
||||
return $user->receivesBroadcastNotificationsOn();
|
||||
}
|
||||
|
||||
$userClass = str_replace('\\', '.', $user::class);
|
||||
|
||||
return "{$userClass}.{$user->getKey()}";
|
||||
}
|
||||
|
||||
public function getNotification(DatabaseNotification $notification): Notification
|
||||
{
|
||||
return Notification::fromDatabase($notification)
|
||||
->date($this->formatNotificationDate($notification->getAttributeValue('created_at')));
|
||||
}
|
||||
|
||||
protected function formatNotificationDate(CarbonInterface $date): string
|
||||
{
|
||||
return $date->diffForHumans();
|
||||
}
|
||||
|
||||
public static function trigger(?string $trigger): void
|
||||
{
|
||||
static::$trigger = $trigger;
|
||||
}
|
||||
|
||||
public static function pollingInterval(?string $interval): void
|
||||
{
|
||||
static::$pollingInterval = $interval;
|
||||
}
|
||||
|
||||
public static function authGuard(?string $guard): void
|
||||
{
|
||||
static::$authGuard = $guard;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string>
|
||||
*/
|
||||
public function queryStringHandlesPagination(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
return view('filament-notifications::database-notifications');
|
||||
}
|
||||
}
|
||||
126
vendor/filament/notifications/src/Livewire/Notifications.php
vendored
Normal file
126
vendor/filament/notifications/src/Livewire/Notifications.php
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Livewire;
|
||||
|
||||
use Filament\Notifications\Collection;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Support\Enums\Alignment;
|
||||
use Filament\Support\Enums\VerticalAlignment;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Livewire\Attributes\On;
|
||||
use Livewire\Component;
|
||||
|
||||
class Notifications extends Component
|
||||
{
|
||||
// Used to check if Livewire messages should trigger notification animations.
|
||||
public bool $isFilamentNotificationsComponent = true;
|
||||
|
||||
public Collection $notifications;
|
||||
|
||||
public static Alignment $alignment = Alignment::Right;
|
||||
|
||||
public static VerticalAlignment $verticalAlignment = VerticalAlignment::Start;
|
||||
|
||||
public static ?string $authGuard = null;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->notifications = new Collection();
|
||||
$this->pullNotificationsFromSession();
|
||||
}
|
||||
|
||||
#[On('notificationsSent')]
|
||||
public function pullNotificationsFromSession(): void
|
||||
{
|
||||
foreach (session()->pull('filament.notifications') ?? [] as $notification) {
|
||||
$notification = Notification::fromArray($notification);
|
||||
|
||||
$this->pushNotification($notification);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $notification
|
||||
*/
|
||||
#[On('notificationSent')]
|
||||
public function pushNotificationFromEvent(array $notification): void
|
||||
{
|
||||
$notification = Notification::fromArray($notification);
|
||||
|
||||
$this->pushNotification($notification);
|
||||
}
|
||||
|
||||
#[On('notificationClosed')]
|
||||
public function removeNotification(string $id): void
|
||||
{
|
||||
if (! $this->notifications->has($id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->notifications->forget($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $notification
|
||||
*/
|
||||
public function handleBroadcastNotification(array $notification): void
|
||||
{
|
||||
if (($notification['format'] ?? null) !== 'filament') {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->pushNotification(Notification::fromArray($notification));
|
||||
}
|
||||
|
||||
protected function pushNotification(Notification $notification): void
|
||||
{
|
||||
$this->notifications->put(
|
||||
$notification->getId(),
|
||||
$notification,
|
||||
);
|
||||
}
|
||||
|
||||
public function getUser(): Model | Authenticatable | null
|
||||
{
|
||||
return auth(static::$authGuard)->user();
|
||||
}
|
||||
|
||||
public function getBroadcastChannel(): ?string
|
||||
{
|
||||
$user = $this->getUser();
|
||||
|
||||
if (! $user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (method_exists($user, 'receivesBroadcastNotificationsOn')) {
|
||||
return $user->receivesBroadcastNotificationsOn();
|
||||
}
|
||||
|
||||
$userClass = str_replace('\\', '.', $user::class);
|
||||
|
||||
return "{$userClass}.{$user->getKey()}";
|
||||
}
|
||||
|
||||
public static function alignment(Alignment $alignment): void
|
||||
{
|
||||
static::$alignment = $alignment;
|
||||
}
|
||||
|
||||
public static function verticalAlignment(VerticalAlignment $alignment): void
|
||||
{
|
||||
static::$verticalAlignment = $alignment;
|
||||
}
|
||||
|
||||
public static function authGuard(?string $guard): void
|
||||
{
|
||||
static::$authGuard = $guard;
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
return view('filament-notifications::notifications');
|
||||
}
|
||||
}
|
||||
313
vendor/filament/notifications/src/Notification.php
vendored
Normal file
313
vendor/filament/notifications/src/Notification.php
vendored
Normal file
@@ -0,0 +1,313 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications;
|
||||
|
||||
use Filament\Notifications\Actions\Action;
|
||||
use Filament\Notifications\Actions\ActionGroup;
|
||||
use Filament\Notifications\Events\DatabaseNotificationsSent;
|
||||
use Filament\Notifications\Livewire\Notifications;
|
||||
use Filament\Support\Components\ViewComponent;
|
||||
use Filament\Support\Concerns\HasColor;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Notifications\DatabaseNotification as DatabaseNotificationModel;
|
||||
use Illuminate\Notifications\Messages\BroadcastMessage;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Str;
|
||||
use PHPUnit\Framework\Assert;
|
||||
|
||||
class Notification extends ViewComponent implements Arrayable
|
||||
{
|
||||
use Concerns\CanBeInline;
|
||||
use Concerns\HasActions;
|
||||
use Concerns\HasBody;
|
||||
use Concerns\HasDate;
|
||||
use Concerns\HasDuration;
|
||||
use Concerns\HasIcon;
|
||||
use Concerns\HasIconColor;
|
||||
use Concerns\HasId;
|
||||
use Concerns\HasStatus;
|
||||
use Concerns\HasTitle;
|
||||
use HasColor;
|
||||
|
||||
/**
|
||||
* @var view-string
|
||||
*/
|
||||
protected string $view = 'filament-notifications::notification';
|
||||
|
||||
protected string $viewIdentifier = 'notification';
|
||||
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $safeViews = [];
|
||||
|
||||
public function __construct(string $id)
|
||||
{
|
||||
$this->id($id);
|
||||
}
|
||||
|
||||
public static function make(?string $id = null): static
|
||||
{
|
||||
$static = app(static::class, ['id' => $id ?? Str::orderedUuid()]);
|
||||
$static->configure();
|
||||
|
||||
return $static;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function getViewData(): array
|
||||
{
|
||||
return $this->viewData;
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->getId(),
|
||||
'actions' => array_map(fn (Action | ActionGroup $action): array => $action->toArray(), $this->getActions()),
|
||||
'body' => $this->getBody(),
|
||||
'color' => $this->getColor(),
|
||||
'duration' => $this->getDuration(),
|
||||
'icon' => $this->getIcon(),
|
||||
'iconColor' => $this->getIconColor(),
|
||||
'status' => $this->getStatus(),
|
||||
'title' => $this->getTitle(),
|
||||
'view' => $this->getView(),
|
||||
'viewData' => $this->getViewData(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $data
|
||||
*/
|
||||
public static function fromArray(array $data): static
|
||||
{
|
||||
$static = static::make($data['id'] ?? Str::random());
|
||||
|
||||
// If the container constructs an instance of child class
|
||||
// instead of the current class, we should run `fromArray()`
|
||||
// on the child class instead.
|
||||
if (
|
||||
($static::class !== self::class) &&
|
||||
(get_called_class() === self::class)
|
||||
) {
|
||||
return $static::fromArray($data);
|
||||
}
|
||||
|
||||
$static->actions(
|
||||
array_map(
|
||||
fn (array $action): Action | ActionGroup => match (array_key_exists('actions', $action)) {
|
||||
true => ActionGroup::fromArray($action),
|
||||
false => Action::fromArray($action),
|
||||
},
|
||||
$data['actions'] ?? [],
|
||||
),
|
||||
);
|
||||
|
||||
$view = $data['view'] ?? null;
|
||||
|
||||
if (filled($view) && ($static->getView() !== $view) && $static->isViewSafe($view)) {
|
||||
$static->view($data['view']);
|
||||
}
|
||||
|
||||
$static->viewData($data['viewData'] ?? []);
|
||||
$static->body($data['body'] ?? null);
|
||||
$static->color($data['color'] ?? null);
|
||||
$static->duration($data['duration'] ?? $static->getDuration());
|
||||
$static->status($data['status'] ?? $static->getStatus());
|
||||
$static->icon($data['icon'] ?? $static->getIcon());
|
||||
$static->iconColor($data['iconColor'] ?? $static->getIconColor());
|
||||
$static->title($data['title'] ?? null);
|
||||
|
||||
return $static;
|
||||
}
|
||||
|
||||
protected function isViewSafe(string $view): bool
|
||||
{
|
||||
return in_array($view, $this->safeViews, strict: true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string | array<string> $safeViews
|
||||
*/
|
||||
public function safeViews(string | array $safeViews): static
|
||||
{
|
||||
$this->safeViews = [
|
||||
...$this->safeViews,
|
||||
...Arr::wrap($safeViews),
|
||||
];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function send(): static
|
||||
{
|
||||
session()->push(
|
||||
'filament.notifications',
|
||||
$this->toArray(),
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model | Authenticatable | Collection | array<Model | Authenticatable> $users
|
||||
*/
|
||||
public function broadcast(Model | Authenticatable | Collection | array $users): static
|
||||
{
|
||||
if (! is_iterable($users)) {
|
||||
$users = [$users];
|
||||
}
|
||||
|
||||
foreach ($users as $user) {
|
||||
$user->notify($this->toBroadcast());
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model | Authenticatable | Collection | array<Model | Authenticatable> $users
|
||||
*/
|
||||
public function sendToDatabase(Model | Authenticatable | Collection | array $users, bool $isEventDispatched = false): static
|
||||
{
|
||||
if (! is_iterable($users)) {
|
||||
$users = [$users];
|
||||
}
|
||||
|
||||
foreach ($users as $user) {
|
||||
$user->notify($this->toDatabase());
|
||||
|
||||
if ($isEventDispatched) {
|
||||
DatabaseNotificationsSent::dispatch($user);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function toBroadcast(): BroadcastNotification
|
||||
{
|
||||
$data = $this->toArray();
|
||||
$data['format'] = 'filament';
|
||||
|
||||
return new BroadcastNotification($data);
|
||||
}
|
||||
|
||||
public function toDatabase(): DatabaseNotification
|
||||
{
|
||||
return new DatabaseNotification($this->getDatabaseMessage());
|
||||
}
|
||||
|
||||
public function getBroadcastMessage(): BroadcastMessage
|
||||
{
|
||||
$data = $this->toArray();
|
||||
$data['format'] = 'filament';
|
||||
|
||||
return new BroadcastMessage($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function getDatabaseMessage(): array
|
||||
{
|
||||
$data = $this->toArray();
|
||||
$data['duration'] = 'persistent';
|
||||
$data['format'] = 'filament';
|
||||
unset($data['id']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function fromDatabase(DatabaseNotificationModel $notification): static
|
||||
{
|
||||
/** @phpstan-ignore-next-line */
|
||||
$static = static::fromArray($notification->data);
|
||||
$static->id($notification->getKey());
|
||||
|
||||
return $static;
|
||||
}
|
||||
|
||||
public static function assertNotified(Notification | string | null $notification = null): void
|
||||
{
|
||||
$notificationsLivewireComponent = new Notifications();
|
||||
$notificationsLivewireComponent->mount();
|
||||
$notifications = $notificationsLivewireComponent->notifications;
|
||||
|
||||
$expectedNotification = null;
|
||||
|
||||
Assert::assertIsArray($notifications->toArray());
|
||||
|
||||
if (is_string($notification)) {
|
||||
$expectedNotification = $notifications->first(fn (Notification $mountedNotification): bool => $mountedNotification->title === $notification);
|
||||
}
|
||||
|
||||
if ($notification instanceof Notification) {
|
||||
$expectedNotification = $notifications->first(fn (Notification $mountedNotification, string $key): bool => $mountedNotification->id === $key);
|
||||
}
|
||||
|
||||
if (blank($notification)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Assert::assertNotNull($expectedNotification, 'A notification was not sent');
|
||||
|
||||
if ($notification instanceof Notification) {
|
||||
Assert::assertSame(
|
||||
collect($expectedNotification)->except(['id'])->toArray(),
|
||||
collect($notification->toArray())->except(['id'])->toArray()
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Assert::assertSame($expectedNotification->title, $notification);
|
||||
}
|
||||
|
||||
public static function assertNotNotified(Notification | string | null $notification = null): void
|
||||
{
|
||||
$notificationsLivewireComponent = new Notifications();
|
||||
$notificationsLivewireComponent->mount();
|
||||
$notifications = $notificationsLivewireComponent->notifications;
|
||||
|
||||
$expectedNotification = null;
|
||||
|
||||
Assert::assertIsArray($notifications->toArray());
|
||||
|
||||
if (is_string($notification)) {
|
||||
$expectedNotification = $notifications->first(fn (Notification $mountedNotification): bool => $mountedNotification->title === $notification);
|
||||
}
|
||||
|
||||
if ($notification instanceof Notification) {
|
||||
$expectedNotification = $notifications->first(fn (Notification $mountedNotification, string $key): bool => $mountedNotification->id === $key);
|
||||
}
|
||||
|
||||
if (blank($notification)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($notification instanceof Notification) {
|
||||
Assert::assertNotSame(
|
||||
collect($expectedNotification)->except(['id'])->toArray(),
|
||||
collect($notification->toArray())->except(['id'])->toArray(),
|
||||
'The notification with the given configration was sent'
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($expectedNotification instanceof Notification) {
|
||||
Assert::assertNotSame(
|
||||
$expectedNotification->title,
|
||||
$notification,
|
||||
'The notification with the given title was sent'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
57
vendor/filament/notifications/src/NotificationsServiceProvider.php
vendored
Normal file
57
vendor/filament/notifications/src/NotificationsServiceProvider.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications;
|
||||
|
||||
use Filament\Notifications\Livewire\DatabaseNotifications;
|
||||
use Filament\Notifications\Livewire\Notifications;
|
||||
use Filament\Notifications\Testing\TestsNotifications;
|
||||
use Filament\Support\Assets\Js;
|
||||
use Filament\Support\Facades\FilamentAsset;
|
||||
use Livewire\Component;
|
||||
use Livewire\Features\SupportTesting\Testable;
|
||||
use Livewire\Livewire;
|
||||
use Spatie\LaravelPackageTools\Package;
|
||||
use Spatie\LaravelPackageTools\PackageServiceProvider;
|
||||
|
||||
use function Livewire\on;
|
||||
use function Livewire\store;
|
||||
|
||||
class NotificationsServiceProvider extends PackageServiceProvider
|
||||
{
|
||||
public function configurePackage(Package $package): void
|
||||
{
|
||||
$package
|
||||
->name('filament-notifications')
|
||||
->hasTranslations()
|
||||
->hasViews();
|
||||
}
|
||||
|
||||
public function packageBooted(): void
|
||||
{
|
||||
FilamentAsset::register([
|
||||
Js::make('notifications', __DIR__ . '/../dist/index.js'),
|
||||
], 'filament/notifications');
|
||||
|
||||
Livewire::component('database-notifications', DatabaseNotifications::class);
|
||||
|
||||
Livewire::component('notifications', Notifications::class);
|
||||
|
||||
on('dehydrate', function (Component $component) {
|
||||
if (! Livewire::isLivewireRequest()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (store($component)->has('redirect')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (count(session()->get('filament.notifications') ?? []) <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$component->dispatch('notificationsSent');
|
||||
});
|
||||
|
||||
Testable::mixin(new TestsNotifications());
|
||||
}
|
||||
}
|
||||
15
vendor/filament/notifications/src/Testing/Autoload.php
vendored
Normal file
15
vendor/filament/notifications/src/Testing/Autoload.php
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Notifications\Testing;
|
||||
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
/**
|
||||
* @return TestCall | TestCase | mixed
|
||||
*/
|
||||
function assertNotified(Notification | string | null $notification = null)
|
||||
{
|
||||
Notification::assertNotified($notification);
|
||||
|
||||
return test();
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user