Skip to content

Commit 735a04b

Browse files
author
Lucas Romano
committed
Refatorings
1 parent 82afbc6 commit 735a04b

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class DocumentAssignedEmail extends Notification implements ShouldQueue
9999
#### 2 - Create the notification event for the intended notification:
100100

101101
```
102-
Batch_Notification_Event::makeOne(
102+
BatchNotificationEvent::queue(
103103
Auth::user(), /* The notifiable model instance. This can be any Notifiable Eloquent model */
104104
$document, /* The eventable instance you want to attach to the notification. All batch's eventables will be present on your notification constructor. This can be any Eloquent model. */
105105
DocumentAssignedEmail::class, /* The fully qualified name of your notification class */

src/Console/DispatchBatchNotifications.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace R64\BatchNotifications\Console;
44

5-
use R64\BatchNotifications\Models\Batch_Notification;
6-
use R64\BatchNotifications\Models\Batch_Notification_Event;
5+
use R64\BatchNotifications\Models\BatchNotification;
6+
use R64\BatchNotifications\Models\BatchNotificationEvent;
77
use Illuminate\Console\Command;
88
use Illuminate\Notifications\Notifiable;
99

@@ -38,15 +38,15 @@ public function __construct()
3838
*/
3939
public function handle()
4040
{
41-
$notifications = Batch_Notification::where('dispatched', false)
41+
$notifications = BatchNotification::where('dispatched', false)
4242
->where('dispatch_at', '<=', now()->toDateTimeString())
4343
->get();
4444

45-
/** @var Batch_Notification $notification */
45+
/** @var BatchNotification $notification */
4646
foreach ($notifications as $notification) {
4747

4848
$eventables = collect();
49-
/** @var Batch_Notification_Event $event */
49+
/** @var BatchNotificationEvent $event */
5050
foreach ($notification->events as $event) {
5151
$eventables->push($event->eventable);
5252
}

src/Models/Batch_Notification.php renamed to src/Models/BatchNotification.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Illuminate\Database\Eloquent\Model;
66

7-
class Batch_Notification extends Model
7+
class BatchNotification extends Model
88
{
99
protected $table = 'batch_notifications';
1010
protected $guarded = ['id'];
@@ -26,6 +26,6 @@ public function notifiable()
2626

2727
public function events()
2828
{
29-
return $this->hasMany(Batch_Notification_Event::class, 'batch_notification_id');
29+
return $this->hasMany(BatchNotificationEvent::class, 'batch_notification_id');
3030
}
3131
}

src/Models/Batch_Notification_Event.php renamed to src/Models/BatchNotificationEvent.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Carbon\Carbon;
66
use Illuminate\Database\Eloquent\Model;
77

8-
class Batch_Notification_Event extends Model
8+
class BatchNotificationEvent extends Model
99
{
1010
protected $table = 'batch_notification_events';
1111
protected $guarded = ['id'];
@@ -23,7 +23,7 @@ public function eventable()
2323

2424
public function batchNotification()
2525
{
26-
return $this->belongsTo(Batch_Notification::class, 'batch_notification_id');
26+
return $this->belongsTo(BatchNotification::class, 'batch_notification_id');
2727
}
2828

2929
/***************************************************************************************
@@ -32,7 +32,7 @@ public function batchNotification()
3232

3333
public static function queue(Model $notifiable, Model $eventable, string $notification_class, Carbon $dispatch_at)
3434
{
35-
$batch_notification = Batch_Notification::firstOrCreate([
35+
$batch_notification = BatchNotification::firstOrCreate([
3636
'notifiable_id' => $notifiable->id,
3737
'notifiable_type' => get_class($notifiable),
3838
'notification_class' => $notification_class,
@@ -41,7 +41,7 @@ public static function queue(Model $notifiable, Model $eventable, string $notifi
4141
'dispatch_at' => $dispatch_at
4242
]);
4343

44-
$event = new Batch_Notification_Event();
44+
$event = new BatchNotificationEvent();
4545
$event->batchNotification()->associate($batch_notification);
4646
$event->eventable()->associate($eventable);
4747

0 commit comments

Comments
 (0)