Sling Academy
Home/PHP/Page 11

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 Query Builder: Using ‘ORDER BY’ Clause

Updated: Jan 17, 2024
Introduction Laravel’s Eloquent ORM is a powerhouse for database operations, providing an expressive and fluent interface that allows web artisans to work with databases in a very convenient manner. One of the core features of......

Executing Subqueries in Laravel Query Builder: Tutorial & Examples

Updated: Jan 17, 2024
Introduction Laravel, the popular PHP framework, provides an elegant ORM called Eloquent and a powerful query builder that streamlines interaction with databases. Leveraging subqueries in Laravel can significantly enhance the......

Left/Right Join in Laravel Query Builder: Tutorial & Examples

Updated: Jan 17, 2024
Introduction Diving into Laravel’s Query Builder allows developers to construct intricate SQL queries with expressive, fluent syntax. In this tutorial, we will focus on understanding and utilizing left and right joins in Laravel.......

How to View Raw SQL Query Generated by Laravel Query Builder

Updated: Jan 17, 2024
Introduction Laravel’s Query Builder provides developers with a convenient way of creating database queries using an object-oriented PHP methodology. While this tool makes it easier to write database queries without writing SQL......

Laravel Query Builder: How to get a random row

Updated: Jan 17, 2024
Introduction Within the fast and elegant Laravel framework, developers often face the need to retrieve a random row from the database. Whether you’re looking to display random quotes, shuffle user profiles, or select a random......

How to update JSON column in Laravel Query Builder

Updated: Jan 17, 2024
Introduction In recent versions of Laravel, working with JSON columns has never been easier, thanks to the robust features of Eloquent and the Query Builder. In this tutorial, we will explore several methods on how to update a JSON......

Increment and Decrement of Column Values in Laravel Query Builder

Updated: Jan 17, 2024
Introduction Laravel’s fluent query builder provides a convenient and easy-to-read way of interacting with databases. When you need to update a numeric column to increment or decrement its current value, Laravel provides simple......

How to Format Date Time in Eloquent (Laravel)

Updated: Jan 17, 2024
Introduction When working with Eloquent in Laravel, the handling of date and time fields is an essential aspect of development. Eloquent, which is the ORM (Object-Relational Mapper) included with Laravel, makes working with dates......

Eloquent: How to Safely Change Column Name in Laravel

Updated: Jan 17, 2024
Introduction Working with databases is a critical part of web development, especially when using an ORM such as Eloquent in Laravel. One common database operation is renaming columns. Although this seems like a straightforward task, it......

Eloquent: How to DROP/TRUNCATE a table

Updated: Jan 17, 2024
Overview In database management, sometimes there is a need to delete all records from a database table or even remove the table entirely. With Eloquent, Laravel’s own ORM (Object-Relational Mapper), these tasks can be performed......

Model Events in Eloquent: A Comprehensive Guide

Updated: Jan 17, 2024
Introduction Eloquent, the ORM included with Laravel, provides a simple and elegant way to work with your database. But its power isn’t limited to just creating, retrieving, updating, and deleting records; it also boasts a......

Eloquent: Convert query result to PHP array

Updated: Jan 17, 2024
Introduction Eloquent is the ORM (Object-Relational Mapper) included with Laravel, which is one of the most popular PHP frameworks. It provides an elegant and simplified syntax for interacting with your database. However, there are......