Sling Academy
Home/PHP/Page 19

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: Create model with default values

Updated: Jan 16, 2024
Introduction When working with Laravel’s Eloquent ORM, one might wish to define default values for a model’s attributes. Eloquent provides an eloquent way to set these default values, ensuring a smoother development process......

created_at and updated_at columns in Eloquent (Laravel)

Updated: Jan 16, 2024
Introduction Laravel is a powerful and elegant PHP framework used by developers for web application development. One of the key features of Laravel is Eloquent, an object-relational mapper (ORM) that provides an ActiveRecord-style ORM......

Eloquent: Define model with optional/nullable fields

Updated: Jan 16, 2024
Introduction to Eloquent and Nullable Fields Eloquent is an ORM (Object-Relational Mapper) included with Laravel, which simplifies the interactions with databases by providing an active record implementation for working with your......

Eloquent: How to specify a different database connection

Updated: Jan 16, 2024
Introduction Laravel’s Eloquent ORM provides an active record implementation that allows you to work with your database objects in an elegant and convenient manner. By default, Eloquent uses the default database connection......

Using UUID and ULID in Laravel Eloquent

Updated: Jan 16, 2024
Introduction When developing web applications, using unique identifiers for database records is crucial. Traditionally, databases use auto-increment integers for primary keys. However, as applications scale and distributed systems......

Eloquent: Creating table with auto-incrementing ID

Updated: Jan 16, 2024
Introduction Laravel’s Eloquent ORM provides an elegant and simple way to interact with your database. A common requirement when designing databases is to have a unique identifier for each row in a table, commonly achieved with......

How to use custom table name in Eloquent (Laravel)

Updated: Jan 16, 2024
Introduction Eloquent ORM (Object-Relational Mapper) is one of the essential features of Laravel that facilitates active record pattern implementation for working with the database. By convention, Eloquent will take the......

4 Ways to Define Model in Eloquent (Laravel)

Updated: Jan 16, 2024
Introduction Laravel’s Eloquent ORM provides an elegant way to interact with databases. Here, we will explore different ways to define models using Eloquent, diving into a range of solutions fitting various scenarios. Approach......

Laravel Query Builder: Select rows where IDs are in an array

Updated: Jan 16, 2024
Introduction Laravel, a popular PHP web application framework, provides developers with various tools to interact with the database. One powerful component within Laravel is the Eloquent ORM, but for those situations where a more......

Laravel Query Builder: ‘GREATER THAN’ and ‘LESS THAN’ Operators

Updated: Jan 16, 2024
Introduction In the world of web development, database queries form the backbone of dynamic applications, and the Laravel PHP framework is no exception. Its eloquent and expressive syntax, stemming from the Query Builder, allows for......

Shared Locking in Laravel Query Builder: A Practical Guide

Updated: Jan 16, 2024
Introduction When working with databases in a web application, especially one that deals with high levels of concurrent access, managing database locking becomes essential to prevent data corruption and to maintain application......

Deleting Records with Conditions in Laravel Query Builder

Updated: Jan 16, 2024
Introduction Laravel, as a powerful PHP framework, offers an elegant query builder to manipulate your database with an expressive syntax. In this post, we’ll explore how to delete records with conditions using Laravel’s......