namespace App\Concerns\Enums;
trait HasLabel
{
public function label(): string
{
return str($this->name)
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 App\Models\Team; | |
| use App\Models\User; | |
| use Database\Seeders\RoleAndPermissionSeeder; | |
| use Database\Seeders\TeamSeeder; | |
| use Database\Seeders\UserSeeder; | |
| use function Pest\Laravel\actingAs; | |
| use function Pest\Laravel\get; |
If you encounter caching issues with your @teleport Livewire/Blade directive after running php artisan view:cache, you may notice problems appearing instead of the expected compilation.
To resolve this issue, manually add compilation to the Blade directive.
class AppServiceProvider extends ServiceProvider
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 | |
| protected static function generateUniqueSlug(string $title): string | |
| { | |
| $slug = str_slug($title); | |
| if (static::query()->where('slug', $slug)->doesntExist()) { | |
| return $slug; | |
| } |
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 Illuminate\Database\Eloquent\Factories\HasFactory; | |
| use Illuminate\Database\Eloquent\Model; | |
| use Illuminate\Support\Facades\DB; | |
| class Blog 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 | |
| // PHP 8.3 introduces exciting new functions for | |
| // incrementing and decrementing alphanumeric strings! | |
| // Let's dive into some examples to see how they work. | |
| // str_increment — Increment an alphanumeric string | |
| echo str_increment("a") . PHP_EOL; // b |
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 | |
| // 🎉 Birthday Check Function 🚀 | |
| use Carbon\Carbon; | |
| function checkBirthday($birthday) | |
| { | |
| return Carbon::now()->isSameDay($birthday) | |
| ? "🎉🥳 Happy Birthday! 🎂 Best wishes for an amazing year ahead! 🚀" | |
| : "🎈 No birthday today. Make it an awesome day anyway! 🌟"; | |
| } |
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\Livewire; | |
| use App\Models\Post; | |
| use Livewire\Component; | |
| class PostList extends Component | |
| { | |
| public $offset = 0; |
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\Http\Livewire; | |
| use Livewire\Component; | |
| use Livewire\Attributes\Renderless; | |
| use App\Traits\HasFilteredReports; | |
| class Reports extends Component | |
| { |
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\Traits\Models; | |
| use App\Models\Team; | |
| use Illuminate\Database\Eloquent\Builder; | |
| trait BelongsToTeam | |
| { | |
| // This method is executed when a new model is being created. |
