-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from lara-zeus/new-letter
New letter
- Loading branch information
Showing
9 changed files
with
1,522 additions
and
1,115 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace LaraZeus\Wind\Events; | ||
|
||
use Illuminate\Broadcasting\Channel; | ||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Broadcasting\PrivateChannel; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
use LaraZeus\Wind\Models\Letter; | ||
|
||
class NewLetterSent | ||
{ | ||
use Dispatchable; | ||
use InteractsWithSockets; | ||
use SerializesModels; | ||
|
||
public Letter $letter; | ||
|
||
/** | ||
* Create a new event instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(Letter $letter) | ||
{ | ||
$this->letter = $letter; | ||
} | ||
|
||
/** | ||
* Get the channels the event should broadcast on. | ||
*/ | ||
public function broadcastOn(): Channel | PrivateChannel | array | ||
{ | ||
return new PrivateChannel('zeus-wind'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/Filament/Resources/LetterResource/Pages/CreateLetter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace LaraZeus\Wind\Filament\Resources\LetterResource\Pages; | ||
|
||
use Filament\Resources\Pages\CreateRecord; | ||
use LaraZeus\Wind\Events\NewLetterSent; | ||
use LaraZeus\Wind\Filament\Resources\LetterResource; | ||
|
||
/** | ||
* @property mixed $record | ||
*/ | ||
class CreateLetter extends CreateRecord | ||
{ | ||
protected static string $resource = LetterResource::class; | ||
|
||
protected function mutateFormDataBeforeCreate(array $data): array | ||
{ | ||
$data['status'] = 'SENT'; | ||
|
||
return $data; | ||
} | ||
|
||
protected function afterCreate(): void | ||
{ | ||
NewLetterSent::dispatch($this->record); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters