SlingAcademy

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: Counting Records Based on a Condition (6 Techniques)

Updated: Jan 18, 2024

Introduction When using Laravel’s Eloquent ORM, one often encounters scenarios where it’s required to count records in a database table based on specific conditions. This allows developers to easily gather insights about......

How to Restore Soft Deleted Models in Eloquent

Updated: Jan 18, 2024

Introduction Eloquent, the ORM (Object-Relational Mapper) included with Laravel, provides the rich functionality of handling interactions with database tables effortlessly. One powerful feature is ‘Soft Deletes’, allowing......

How to Compare Two Models in Eloquent

Updated: Jan 18, 2024

Introduction When dealing with object-relational mapping in Laravel’s Eloquent, it is often necessary to compare two models to determine if they represent the same record in the database or to see what attributes have changed......

How to create REST API with Laravel (no views)

Updated: Jan 18, 2024

Introduction RESTful APIs are the backbone of modern web applications, providing a way for various systems to communicate with each other. Laravel, a powerful PHP framework, makes building these APIs a breeze, emphasizing simplicity,......

How to implement GraphQL in Laravel

Updated: Jan 18, 2024

Overview Integrating GraphQL into your Laravel project can be a game-changer for your web application. GraphQL provides a more efficient and powerful alternative to the traditional REST API. It allows clients to query for exactly the......

Laravel Eloquent: CRUD Example

Updated: Jan 18, 2024

Introduction Welcome to this Laravel Eloquent CRUD example tutorial. In this guide, we’ll dive deep into how to use Eloquent, Laravel’s own ORM (Object-Relational Mapper), to interact with your database using a rich and......

Can you use Eloquent ORM without Laravel?

Updated: Jan 18, 2024

Introduction Eloquent ORM is a powerful Object-Relational Mapper designed for Laravel, but what if you want to use it without the full Laravel framework? Luckily, Eloquent can be implemented as a standalone package. In this tutorial,......

Using ‘UNION’ in Laravel Eloquent

Updated: Jan 18, 2024

Introduction The UNION SQL operation is an essential tool for database queries that combine results from multiple SELECT statements. It’s invaluable when working with complex data structures, allowing developers to merge rows......

Laravel Eloquent: Change column type with migration

Updated: Jan 18, 2024

Introduction Laravel’s Eloquent ORM provides an elegant and efficient way to interact with your database. However, there might come a time when you need to change the type of a column in your table, and Laravel’s migrations......