This file contains hidden or 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
| <?php | |
| namespace App\Models; | |
| use App\Enums\OrderStatus; | |
| use App\Enums\TicketStatus; | |
| use ArtisanBuild\FatEnums\Casts\AsPolymorphicEnum; | |
| class Activity extends Model | |
| { |
This file contains hidden or 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
| <?php | |
| declare(strict_types=1); | |
| namespace App\Enums; | |
| enum Permission: int | |
| { | |
| case ViewReports = 0x1 << 0; | |
| case EditContent = 0x1 << 1; |
This file contains hidden or 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
| <?php | |
| namespace App\Enums; | |
| enum PublishingWorkflow: string implements StateMachine | |
| { | |
| use IsStateMachine; | |
| public const DEFAULT = self::Draft; |
This file contains hidden or 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
| <?php | |
| namespace App\Models; | |
| use App\Enums\OrderStatus; | |
| use ArtisanBuild\FatEnums\Concerns\ModelHasStateMachine; | |
| use Illuminate\Database\Eloquent\Model; | |
| class Order extends Model | |
| { |
This file contains hidden or 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
| <?php | |
| $status = OrderStatus::Pending; | |
| // Check if transition is valid | |
| $status->canTransitionTo(OrderStatus::Processing); // true | |
| $status->canTransitionTo(OrderStatus::Delivered); // false | |
| // Perform the transition | |
| $newStatus = $status->transitionTo(OrderStatus::Processing); |
This file contains hidden or 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
| <?php | |
| namespace App\Enums; | |
| use ArtisanBuild\FatEnums\Attributes\CanTransitionTo; | |
| use ArtisanBuild\FatEnums\Attributes\CanTransitionToSelf; | |
| use ArtisanBuild\FatEnums\Attributes\FinalState; | |
| use ArtisanBuild\FatEnums\Concerns\IsStateMachine; | |
| use ArtisanBuild\FatEnums\Contracts\StateMachine; |
This file contains hidden or 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
| <?php | |
| // What happens when data is missing? | |
| // 1. Missing the attribute entirely throws MissingDataAttributeException | |
| #[WithData(['label' => 'Active'])] | |
| case Active = 'active'; | |
| case Inactive = 'inactive'; // No attribute! |
This file contains hidden or 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
| <?php | |
| namespace App\Enums; | |
| use ArtisanBuild\FatEnums\Attributes\WithData; | |
| use ArtisanBuild\FatEnums\Concerns\HasKeyValueAttributes; | |
| enum SubscriptionTier: string | |
| { | |
| use HasKeyValueAttributes; |
This file contains hidden or 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
| /bin/bash -c "$(curl -fsSL https://php.new/install/linux)" | |
| export PATH="/root/.config/herd-lite/bin/:$PATH" | |
| composer config http-basic.composer.fluxui.dev {flux_username} {flux_key} | |
| composer install | |
| cp .env.example .env | |
| php artisan key:generate | |
| php artisan migrate --seed --force -n | |
| npm install | |
| npm run build |
This file contains hidden or 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
| <?php | |
| use Illuminate\Support\Collection; | |
| class Raffle | |
| { | |
| private int $total = 0; | |
| private int $current = 0; | |
| private Collection $entries; |
NewerOlder