Sling Academy
Home/PHP/Page 18

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,

Eloquent: How to retrieve last/first record from table

Updated: Jan 16, 2024
Introduction Eloquent ORM (Object-Relational Mapping) is a powerful and convenient way to interact with databases in Laravel applications. Among the many tasks that Eloquent can help with, a common one is retrieving the last or first......

Eloquent: Sorting Records by Multiple Columns

Updated: Jan 16, 2024
Introduction Eloquent ORM is an elegant query builder for PHP and Laravel developers, providing a fluent interface to interact with databases. One common operation when dealing with databases is sorting records based on one or more......

Laravel & Eloquent: Pagination Examples

Updated: Jan 16, 2024
Introduction Dealing with datasets in web applications can be tricky – especially when it comes to handling large amounts of data while ensuring the application remains responsive. In this guide, we will demonstrate the use of......

Eloquent: Limiting Query Results with limit() Method

Updated: Jan 16, 2024
Introduction Eloquent ORM is an integral part of the Laravel framework, providing a sleek, simple, yet powerful ActiveRecord implementation for working with your database. One common requirement in web development is controlling the......

Eloquent: Sorting Results with orderBy() Method

Updated: Jan 16, 2024
Introduction Sorting data is an essential aspect of building a robust web application, particularly when dealing with database records. Eloquent, the powerful ORM included with Laravel, simplifies database interactions and provides a......

Eloquent: Filtering query results with whereColumn() method

Updated: Jan 16, 2024
Introduction The Eloquent ORM (Object-Relational Mapping) that comes with Laravel is well-loved for its ability to interact with database objects using a simple and expressive syntax. One of the dynamic methods Eloquent provides is......

Eloquent: Selecting Specific Columns from a Table

Updated: Jan 16, 2024
Introduction to Eloquent Selections When working with Eloquent, the ORM for Laravel, efficiently querying your database is crucial for performance and scalability. Here, we will cover how to select specific columns from your database......

Using the lazy() and the cursor() methods in Eloquent (Laravel)

Updated: Jan 16, 2024
Overview One of the ignition points for innovation in web development with PHP is the Laravel framework. With its elegant syntax and advanced features, Laravel provides web artisans with tools necessary for crafting state-of-the-art......

How to chunk results in Eloquent (Laravel)

Updated: Jan 16, 2024
Introduction When working with large datasets in Laravel, using the Eloquent ORM can sometimes lead to memory overload due to the size of the results returned. To avoid this problem and to handle big data efficiently, Eloquent provides......

Polymorphic Relations in Eloquent: Explained with Examples

Updated: Jan 16, 2024
Introduction Polymorphic relations in Laravel’s Eloquent ORM provide a way to set up a single association to different models. This guide walks you through the concept of polymorphic relationships, showing code examples and......

Understanding Scopes in Eloquent (with examples)

Updated: Jan 16, 2024
Introduction Laravel’s Eloquent ORM provides a beautiful, simple ActiveRecord implementation for working with your database. One of its less discussed, yet powerful features, are the scopes. Scopes allow you to encapsulate part......

Laravel Eloquent ORM: How to Alter a Table

Updated: Jan 16, 2024
Introduction Laravel’s Eloquent ORM is a powerful tool for interacting with your database in an object-oriented way. Altering a database table’s structure is a common task during application development. This tutorial......