Short information about global scopes
Global scopes allow you to add conditions to ALL queries for a particular Model. For example, if you want all records to be always ordered in a certain way.
Read more in the official Laravel docs.
Repository: guillaumebriday/laravel-blog
(Github)
★ 1317
Created: Dec 2016
Updated: May 2021
Laravel version: 8
Files in the example:
- master/app/Scopes/PostedScope.php- app/Models/Post.php
Repository: Kovah/LinkAce
(Github)
★ 822
Created: Aug 2018
Updated: Jun 2021
Laravel version: 8
Files in the example:
- app/Scopes/OrderNameScope.php- app/Models/LinkList.php
Repository: LaravelDaily/Laravel-Support-Ticketing
(Github)
★ 152
Created: Nov 2019
Updated: Mar 2021
Laravel version: 8
Files in the example:
- app/Scopes/AgentScope.php- app/Ticket.php
Repository: jcergolj/laravellte
(Github)
★ 122
Created: Jan 2020
Updated: Jun 2021
Laravel version: 8
Files in the example:
- app/Scopes/VisibleToScope.php- app/Models/User.php
Repository: OpenLitterMap/openlittermap-web
(Github)
★ 54
Created: Aug 2020
Updated: Jul 2021
Laravel version: 8
Files in the example:
- app/Models/User/User.php
Repository: academico-sis/academico
(Github)
★ 45
Created: Dec 2018
Updated: Aug 2021
Laravel version: 8
Files in the example:
- app/Models/ExternalCourse.php
Repository: ammannbe/RecipeManager
(Github)
★ 19
Created: Dec 2018
Updated: Feb 2021
Laravel version: 8
Files in the example:
- app/Models/OrderByNameScope.php- app/Models/Ingredients/Unit.php
Repository: JuanDMeGon/Laravel-from-Scratch
(Github)
★ 11
Created: Apr 2020
Updated: Mar 2021
Laravel version: 8
Files in the example:
- app/Scopes/AvailableScope.php- app/Product.php
Repository: Senither/ShareX-Media-Server
(Github)
★ 9
Created: Oct 2016
Updated: Jul 2021
Laravel version: 8
Files in the example:
- app/Scopes/UserScope.php- app/Traits/BelongsToUser.php
- app/Models/Url.php
Repository: mohsin-shaikh/expense-tracker
(Github)
★ 4
Created: Jan 2022
Updated: Feb 2022
Laravel version: 8
Files in the example:
- app/Scopes/UserVisibilityScope.php- app/Models/Category.php
Additional resources on global scopes:
-
Bert Heyman | dev.to
Published on