notifications added

This commit is contained in:
Benjamin Takats
2022-12-15 14:51:56 +01:00
parent f217c4a04d
commit 9e43f166a3
23 changed files with 276 additions and 25 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Nova;
use App\Notifications\ModelCreatedNotification;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\Avatar;
@@ -66,6 +67,15 @@ class Episode extends Resource
return $this->data['title'];
}
public static function afterCreate(NovaRequest $request, Model $model)
{
\App\Models\User::find(1)
->notify(new ModelCreatedNotification($model, str($request->getRequestUri())
->after('/nova-api/')
->before('?')
->toString()));
}
/**
* Get the fields displayed by the resource.
*
@@ -102,7 +112,7 @@ class Episode extends Resource
BelongsTo::make(__('Podcast'), 'podcast', Podcast::class)
->readonly(),
BelongsTo::make(__('Created By'), 'createdBy', User::class),
BelongsTo::make(__('Created By'), 'createdBy', User::class)->onlyOnIndex(),
];
}