namespace App\Models;
use ToneflixCode\ApprovableNotifications\Traits\SendsApprovableNotifications;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use SendsApprovableNotifications;
}
namespace App\Models;
use ToneflixCode\ApprovableNotifications\Traits\HasApprovableNotifications;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use HasApprovableNotifications;
}
namespace App\Models;
use ToneflixCode\ApprovableNotifications\Traits\ApprovableNotifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use ApprovableNotifiable;
}
$faker = \Faker\Factory::create();
$user = \App\Models\User::find(1);
$sender =\App\Models\User::find(12);
$actionable =\App\Models\User::find(5);
$notif = $sender->sendApprovableNotification(
recipient: $user, // The recieving model
title: $faker->sentence(4), // The title of the notification
message: $faker->sentence(10), // The notification text message body
data: ['icon' => 'fas fa-info'], // Any extra data you would like to store,
actionable: $actionable, // Any model you would like to access or reference later during retrieval
);
namespace App\Models;
use ToneflixCode\ApprovableNotifications\Traits\SendsApprovableNotifications;
use Illuminate\Foundation\Auth\User as Authenticatable;
use ToneflixCode\ApprovableNotifications\Models\Notification;
class User extends Authenticatable
{
use SendsApprovableNotifications;
public function newNotificationCallback(Notification $notification) {
// Perform any other actions here when a notification is created
}
}
namespace App\Models;
use ToneflixCode\ApprovableNotifications\Traits\HasApprovableNotifications;
use Illuminate\Foundation\Auth\User as Authenticatable;
use ToneflixCode\ApprovableNotifications\Models\Notification;
class User extends Authenticatable
{
use HasApprovableNotifications;
public function approvedNotificationCallback(Notification $notification) {
// Perform any other actions here when a notification is approved
}
public function rejectedNotificationCallback(Notification $notification) {
// Perform any other actions here when a notification is rejected
}
}