Sling Academy
Home/PHP/Page 15

PHP

PHP is a popular scripting language for web development. It can create dynamic and interactive web pages by running on the server and sending HTML to the browser. It is free, fast, and flexible,

Laravel Eloquent: How to merge multiple collections

Updated: Jan 17, 2024
Introduction Laravel, a popular PHP web application framework, is known for its eloquent ORM that provides a beautiful, simple ActiveRecord implementation for working with databases. Within Eloquent, a common task developers may......

Using many-to-many relationships in Eloquent (with examples)

Updated: Jan 17, 2024
Introduction When working with databases in a Laravel application, the Eloquent ORM provides an expressive and convenient way to interact with database relationships. Many-to-many relationships are one of the complex types you’ll......

Working with one-to-many relationships in Eloquent (with examples)

Updated: Jan 17, 2024
Introduction When developing applications with Laravel, understanding Eloquent relationships is fundamental for the proper management of database records. One of the most common types of relationships in database design is the......

Eloquent: 5 Ways to Exclude Specific Columns from Query Result

Updated: Jan 17, 2024
Introduction Laravel’s Eloquent ORM is a powerful and elegant way to interact with your database. Often times, you may need to exclude specific columns from your query results for optimization, security, or data transformation......

Laravel Eloquent: 3 Ways to Check if a Record Exists

Updated: Jan 17, 2024
Overview If you are working with Laravel’s Eloquent ORM, checking for the existence of records in the database is a common task that can be approached in several ways. This guide explores diverse methods to perform this check......

Laravel Eloquent: ‘IN’ and ‘NOT IN’ operators

Updated: Jan 17, 2024
Overview Laravel, as one of the most prominent PHP frameworks, provides a robust ORM called Eloquent for interacting with databases. Eloquent allows developers to write database queries in a clean, fluent API while maintaining......

Laravel Eloquent: Counting records in related tables

Updated: Jan 17, 2024
Understanding Eloquent Relationships One of the most powerful features of Laravel is Eloquent ORM, which allows for seamless interaction with the database using expressive syntax. When working with related models, it often becomes......

Laravel Eloquent: Find MIN/MAX in each group

Updated: Jan 17, 2024
Introduction Laravel’s Eloquent ORM is a powerful tool for interacting with your database using an expressive, fluent API to create, retrieve, update, and delete database records. Among many other things, Eloquent allows you to......

Laravel Eloquent: Column with Unsigned Integer

Updated: Jan 17, 2024
Introduction Laravel, a popular PHP framework, simplifies database manipulation with its Eloquent ORM. An understanding of how to use unsigned integers is vital when working with foreign keys and fields intended to store non-negative......

Laravel Eloquent: How to add UNIQUE constraint

Updated: Jan 17, 2024
Introduction Laravel’s Eloquent ORM provides a simple ActiveRecord implementation for working with your database. When dealing with relational databases, uniqueness constraints are essential to ensure the data integrity by......

Laravel Eloquent: Using groupBy() to group results by a column

Updated: Jan 17, 2024
Introduction Laravel Eloquent ORM provides a beautiful, simple ActiveRecord implementation for working with your database. Each database table has a corresponding “Model” that is used to interact with that table. In this......

Laravel Eloquent: How to Cascade Delete Related Models

Updated: Jan 17, 2024
Introduction Laravel Eloquent provides an active record implementation that allows developers to work with database objects in a more intuitive way. Deleting records along with their related models is an important aspect of handling......