Examples of Observers (14)

Short information about observers

Observer class may be called as a type of Listener class, listening to the events of changes on particular Eloquent Model.
With the command php artisan make:observer --model=ModelName you can create an Observer class that would automatically listen to ModelName (like, "User") events like created(), updated(), etc.
A typical example is updating related records in other DB tables after some change happened in the main related table.
Read more in the official Laravel docs.

Repository: koel/koel (Github)
★ 13870 Created: Dec 2015 Updated: Aug 2022 Laravel version: 8
Files in the example:
- app/Observers/SongObserver.php
- app/Providers/EventServiceProvider.php
Repository: akaunting/akaunting (Github)
★ 5417 Created: Sep 2017 Updated: Aug 2022 Laravel version: 8
Files in the example:
- app/Observers/Transaction.php
- app/Providers/Observer.php
- config/app.php
Repository: pterodactyl/panel (Github)
★ 4072 Created: Dec 2016 Updated: Aug 2022 Laravel version: 8
Files in the example:
- app/Observers/ServerObserver.php
- app/Providers/AppServiceProvider.php
Repository: pixelfed/pixelfed (Github)
★ 3752 Created: Apr 2018 Updated: Aug 2022 Laravel version: 8
Files in the example:
- app/Observers/AvatarObserver.php
- app/Providers/AppServiceProvider.php
Repository: Bottelet/DaybydayCRM (Github)
★ 2016 Created: Jul 2016 Updated: Jul 2022 Laravel version: 7
Files in the example:
- app/Observers/TaskObserver.php
- app/Providers/AppServiceProvider.php
Repository: LaravelDaily/Laravel-Support-Ticketing (Github)
★ 195 Created: Nov 2019 Updated: Mar 2021 Laravel version: 8
Files in the example:
- app/Observers/TicketActionObserver.php
- app/Ticket.php
Repository: ploi-deploy/roadmap (Github)
★ 138 Created: May 2022 Updated: Aug 2022 Laravel version: 9
Files in the example:
- app/Observers/CommentObserver.php
- app/Providers/EventServiceProvider.php
Repository: PHPJunior/mtube (Github)
★ 107 Created: Jul 2021 Updated: Sep 2021 Laravel version: 8
Files in the example:
- app/Observers/VideoObserver.php
- app/Providers/AppServiceProvider.php
Repository: Astrotomic/opendor.me (Github)
★ 68 Created: May 2021 Updated: May 2022 Laravel version: 8
Files in the example:
- app/Observers/OrganizationObserver.php
- app/Providers/EventServiceProvider.php
Repository: ammannbe/RecipeManager (Github)
★ 31 Created: Dec 2018 Updated: Aug 2021 Laravel version: 8
Files in the example:
- app/Observers/Users/AuthorObserver.php
- app/Providers/ObserverServiceProvider.php
- config/app.php
Repository: Senither/ShareX-Media-Server (Github)
★ 30 Created: Oct 2016 Updated: Jul 2022 Laravel version: 8
Files in the example:
- app/Observers/ImageObserver.php
- app/Providers/AppServiceProvider.php
Repository: devhub-az/devhub (Github)
★ 23 Created: Dec 2019 Updated: Jul 2022 Laravel version: 8
Files in the example:
- app/Observers/ArticleObserver.php
- app/Providers/AppServiceProvider.php
Repository: MdMostaFizurRahaman/ecommerce (Github)
★ 17 Created: May 2022 Updated: May 2022 Laravel version: 8
Files in the example:
- app/Observers/OrderItemObserver.php
- app/Providers/ObserverServiceProvider.php
Repository: Melcus/parking-system (Github)
★ 7 Created: May 2021 Updated: Feb 2022 Laravel version: 8
Files in the example:
- app/Observers/ReservationObserver.php
- app/Providers/AppServiceProvider.php

Additional resources on observers: