Skip to content

Archive

Laravel

9 articles
Web Development 04 Sep 2025 3 min read

Building an Article CRUD with Laravel and Filament Admin Panel

Laravel provides a productive foundation for modern PHP applications, and Filament can add a powerful admin panel with generated forms, tables, and CRUD pages. In this tutorial, we will create a Laravel project and build an Article CRUD resource with Filament. 1. Create a New Laravel Project composer create-project --prefer-dist laravel/laravel website The final argument, website, is the project directory name. Change it if you want a different project name.

Web Development 03 Sep 2025 3 min read

Running Laravel Queues on cPanel with Cron Jobs

Laravel queues are useful for work that should not block an HTTP request, such as sending email, generating reports, importing data, or processing files. On a VPS, a process supervisor is usually the best way to keep long-running queue workers alive. Shared cPanel hosting often does not provide that option, so a cron-driven worker can be a practical fallback. This pattern starts a worker periodically and tells it to exit once the queue becomes empty.

Web Development 03 Sep 2025 3 min read

Automatically Encrypting Eloquent Model Attributes

Applications often store fields that deserve additional protection at rest. Laravel can encrypt selected Eloquent attributes before they are written to the database and decrypt them automatically when they are read. For modern Laravel applications, the built-in encrypted cast is preferable to overriding Eloquent’s magic __get() and __set() methods. It integrates with the model casting system and avoids interfering with Eloquent internals. Basic Implementation Define encrypted attributes in the model’s casts:

Web Development Updated 02 Sep 2025 2 min read

Building a Live Search Page in Filament PHP

Real-time search can make an admin dashboard much easier to use. Filament is built on Livewire, so a custom resource page can react to search input without writing a separate frontend application. This example adds a live-search page to a PostResource. 1. Generate a Custom Page Generate a custom page inside the resource: php artisan make:filament-page SearchPost --resource=PostResource --type=custom The exact generated path can vary by Filament version and panel structure, so check the files created by the command.

Web Development Updated 02 Sep 2025 3 min read

Building a Simple CRUD Application in Laravel: A Practical Guide

Building a CRUD application is one of the best ways to learn the core pieces of Laravel. In this guide, we will create a simple Post resource that supports Create, Read, Update, and Delete operations using Eloquent, resource routes, validation, and Blade views. 1. Create the Laravel Project Make sure Composer and a supported PHP version are installed, then run: composer create-project --prefer-dist laravel/laravel laravel-crud cd laravel-crud php artisan serve The development server is normally available at http://localhost:8000.

Web Development Updated 02 Sep 2025 3 min read

Building a Nested Category API in Laravel 11: A Practical Guide

Nested categories are common in e-commerce platforms, CMS applications, documentation systems, and other products that need hierarchical navigation. In Laravel, a self-referencing Eloquent relationship can model a category that belongs to a parent and has any number of children. This Laravel 11 example builds a small API for creating and reading category trees. 1. Create the Laravel Project composer create-project --prefer-dist laravel/laravel laravel-nested-categories cd laravel-nested-categories php artisan serve 2. Create the Category Model and Migration php artisan make:model Category -m Define the table in the generated migration:

Web Development Updated 02 Sep 2025 3 min read

Data Validation in Laravel: A Complete Developer Guide

Validation is an important boundary in web applications. It ensures incoming data has the shape and constraints your application expects before that data reaches business logic or persistence. Laravel provides several validation APIs, from quick controller validation to reusable Form Request classes and custom rules. 1. Basic Validation For small request handlers, call validate() on the request: use Illuminate\Http\Request; public function store(Request $request) { $validatedData = $request->validate([ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'email', 'unique:users,email'], 'password' => ['required', 'string', 'min:8', 'confirmed'], ]); // Use $validatedData rather than the entire request payload. } For a normal browser request, Laravel redirects back with validation errors in the session. For requests expecting JSON, Laravel returns a validation error response, normally with HTTP status 422.

Web Development Updated 07 Sep 2025 3 min read

Understanding HTTP Status Codes in Laravel: A Developer's Guide

HTTP status codes tell clients whether a request succeeded, failed, requires authentication, or encountered another condition. Choosing the right status code makes Laravel APIs easier to consume and helps clients implement predictable error handling. 200: OK Use 200 OK when a request succeeds and the response includes a representation or other useful content. Common cases: A successful GET request that returns data. A successful update that returns the updated resource. A successful action endpoint that returns a result. 201: Created Use 201 Created after successfully creating a new resource, usually from a POST request.

Web Development Updated 07 Sep 2025 3 min read

Managing Image Uploads and Resizing with Laravel and Intervention Image

Image handling is a common requirement in web applications. Uploading original files, creating thumbnails, converting formats, and cleaning up old files all need to be handled consistently. Laravel’s filesystem abstraction works well with image-processing libraries such as Intervention Image. The code in this article uses the classic Intervention Image v2-style API (Image::make, fit, and encode). Intervention Image v3 uses a different API, so check the package version installed in your project before copying the example directly.