public function boot(): void
{
// Observe the DatabaseNotification model for created events
DatabaseNotification::observe(new class {
// Listen to the created event
public function created(DatabaseNotification $notification): void
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\Events\MessageSent; | |
| use Livewire\Volt\Component; | |
| new class extends Component | |
| { | |
| /** | |
| * @var string[] | |
| */ |
Aka "Do we need a PhD to add images on websites ?"
I focus here on reponsive images. Loading and accessibility topics are not detailed. For the purpose of the article, I've just used the <img> markup, but for real use cases, <picture> will fill all the needs.
Goal: to display elements consistently on screens with different densities
To test the following sections, you need to open Development Tools, and play with different screen sizes. Be aware that the browser keeps the last image in a memory cache, you should disable the cache or refresh the page to see your expected results.
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\Rules; | |
| use Illuminate\Contracts\Validation\Rule; | |
| class ImageMaliciousDetectionRule implements Rule | |
| { | |
| protected $malicious_keywords = [ | |
| '\\/bin\\/bash', |
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 | |
| return [ | |
| 'bs' => 'Bosnian', | |
| 'ee_TG' => 'Ewe (Togo)', | |
| 'ms' => 'Malay', | |
| 'kam_KE' => 'Kamba (Kenya)', | |
| 'mt' => 'Maltese', | |
| 'ha' => 'Hausa', | |
| 'es_HN' => 'Spanish (Honduras)', |
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\Abilities; | |
| use Illuminate\Support\Str; | |
| use ReflectionClass; | |
| /** | |
| * Note: This is a preview of an upcoming package from Tighten. | |
| **/ |
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 | |
| $countries = array | |
| ( | |
| 'AF' => 'Afghanistan', | |
| 'AX' => 'Aland Islands', | |
| 'AL' => 'Albania', | |
| 'DZ' => 'Algeria', | |
| 'AS' => 'American Samoa', | |
| 'AD' => 'Andorra', |