ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Part 9: Eloquent Events - Laravel 5.4 New Features

Автор: DevMarketer

Загружено: 2017-02-20

Просмотров: 19143

Описание: In Laravel 5.4 we can now tie eloquent events to our normal event classes. This allows us to tuck custom functionality to when new models and items are added to our database with very little effort.

While it might seem confusing at first for a newcomer, the events system requires several files but it makes sense once you wrap your head around it.

The file that controls all events is the EventServiceProvider. This is the file that displays all the events to listen for and the listeners to fire when the event is triggered. You can set up these relationships in a basic associated array format, with as many listeners as you want tied to a specific event.

Once you set up the relationship you can generate the files needed, by using the artisan console command:

php artisan event:generate

This will create an Events and a Listeners folder with the new events and listeners files inside them.

We will customize the event file only because we want to tell the event to pass a user eloquent object along to the listener, otherwise there would be no other need to customize this file. By customizing this file, we tell it to pass the user object to the listener.

In the listener, we can tell the listener which code to execute by putting the code in the Handler() function. For this tutorial, this is where we add the Mail command.

This is the basic event/listener relationship, but when we want to tie it to your Eloquent events, then we establish the connection in our model. In our case, it is the User model. In the user model, we will create a new protected attribute called $events and then set up the eloquent event to our custom Event Classes as shown in the video.

Now when the eloquent event fires, it triggers our custom Event class and then fires the listener.

For more information about Events/Listeners in general:
https://laravel.com/docs/5.4/events

For more information about Eloquent Events:
https://laravel.com/docs/5.4/eloquent...

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Part 9: Eloquent Events - Laravel 5.4 New Features

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

Part 8: Markdown Email Mailables - Laravel 5.4 New Features

Part 8: Markdown Email Mailables - Laravel 5.4 New Features

Laravel 5.4 New Features - Part 1: All the Small Changes Overview

Laravel 5.4 New Features - Part 1: All the Small Changes Overview

Part 6: Components & Slots - Laravel 5.4 New Features

Part 6: Components & Slots - Laravel 5.4 New Features

Multiple Authentication in Laravel 5.4 Natively! (Admins + Users) - Part 1

Multiple Authentication in Laravel 5.4 Natively! (Admins + Users) - Part 1

Создавайте лучшие веб-приложения с Blazor в .NET 10

Создавайте лучшие веб-приложения с Blazor в .NET 10

Part 7: Laravel Dusk - Laravel 5.4 New Features

Part 7: Laravel Dusk - Laravel 5.4 New Features

🔴АУСЛЕНДЕР: россиян ПОДАВИЛИ в Купянске! Герасимов получил нагоняй от высшего командования

🔴АУСЛЕНДЕР: россиян ПОДАВИЛИ в Купянске! Герасимов получил нагоняй от высшего командования

Websockets in Laravel - Part 3: Handling Socket Server Events

Websockets in Laravel - Part 3: Handling Socket Server Events

(Part 2) Logging In Multiple Users - Native Multi Auth in Laravel 5.4

(Part 2) Logging In Multiple Users - Native Multi Auth in Laravel 5.4

Сисадмины больше не нужны? Gemini настраивает Linux сервер и устанавливает cтек N8N. ЭТО ЗАКОННО?

Сисадмины больше не нужны? Gemini настраивает Linux сервер и устанавливает cтек N8N. ЭТО ЗАКОННО?

F90: прямой эфир, философия программиста, вопросы и ответы

F90: прямой эфир, философия программиста, вопросы и ответы

HUGE NEW FEATURE: API Resources (14/14) - Laravel 5.5 New Features

HUGE NEW FEATURE: API Resources (14/14) - Laravel 5.5 New Features

Kubernetes — Простым Языком на Понятном Примере

Kubernetes — Простым Языком на Понятном Примере

Websockets in Laravel - Part 1: Configuring Laravel for Websockets

Websockets in Laravel - Part 1: Configuring Laravel for Websockets

Using Subdomain in Laravel for Staging, Beta, and Live Servers

Using Subdomain in Laravel for Staging, Beta, and Live Servers

Стоило ли покупать УБИТЫЙ MacBook за 5000₽? Результат ШОКИРОВАЛ! Ремонт MacBook Pro 15 1013 a1398

Стоило ли покупать УБИТЫЙ MacBook за 5000₽? Результат ШОКИРОВАЛ! Ремонт MacBook Pro 15 1013 a1398

Laravel 6 Advanced - e1 - Контейнер служб

Laravel 6 Advanced - e1 - Контейнер служб

Как строили корабли для мирового господства

Как строили корабли для мирового господства

ГИТАРИСТ притворился БЕЗДОМНЫМ и шокировал ЛЮДЕЙ отбил ЛЮБОВЬ и ПРИОДЕЛСЯ

ГИТАРИСТ притворился БЕЗДОМНЫМ и шокировал ЛЮДЕЙ отбил ЛЮБОВЬ и ПРИОДЕЛСЯ

ОБЗОР РЕФЛЕКСИИ В С++26

ОБЗОР РЕФЛЕКСИИ В С++26

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]