May 2023

Mastering Validation in Laravel: Essential Methods for Form Validation

Post: Laravel, one of the most popular PHP frameworks, offers a robust and efficient way to validate incoming data. Proper validation ensures that your application handles user inputs securely and accurately. In this post, we will explore the essential methods for performing validation in Laravel, allowing you to build reliable and error-free web applications. Let’s […]

Mastering Validation in Laravel: Essential Methods for Form Validation Read More »

Understanding the query() Method in Laravel’s Eloquent ORM for Dynamic Query Building

Last Updated on May 23, 2023 by Moh   In Laravel, when using the Eloquent ORM, you can directly use methods like `where()` or `orderBy()` on the model itself without explicitly calling `query()`. For example: // Retrieve users with a specific condition$users = User::where(‘age’, ‘>’, 25)->get();// Retrieve users with multiple conditions$users = User::where(‘age’, ‘>’, 25)->orderBy(‘name’)->get();

Understanding the query() Method in Laravel’s Eloquent ORM for Dynamic Query Building Read More »

Setting Up SSH Connection between Ubuntu 22 and GitHub: A Step-by-Step Guide

Last Updated on May 23, 2023 by Moh To make an SSH connection between Ubuntu 22 and GitHub, you can follow these steps: 1. Generate an SSH key pair: run the following command to generate an SSH key pair:   ssh-keygen -t ed25519 -C “[email protected]”   Replace `”[email protected]”` with your actual email address. You can

Setting Up SSH Connection between Ubuntu 22 and GitHub: A Step-by-Step Guide Read More »

Best Practices: Running ‘apt update’ and ‘apt upgrade’ for Package Management

Last Updated on May 12, 2023 by Moh The `apt update` and `apt upgrade` commands are commonly used in package management on Debian-based systems like Ubuntu. Here’s what each command does: 1. `apt update`: This command updates the local package index. It retrieves the latest information about available packages from the software repositories configured on

Best Practices: Running ‘apt update’ and ‘apt upgrade’ for Package Management Read More »

Getting the ID of a Newly Inserted Record in Laravel using save() Method

Last Updated on May 10, 2023 by Moh In Laravel, you can get the ID of a newly inserted record after calling the `save()` method on an Eloquent model by accessing the `id` property of the model. Here is an example:  // Create a new User model instance$user = new AppModelsUser;// Set some attributes on

Getting the ID of a Newly Inserted Record in Laravel using save() Method Read More »

Laravel Unique Validation on Multiple Columns

Last Updated on May 10, 2023 by Moh Let’s discuss this example:    ‘username’ => [ ‘required’, Rule::unique(‘users’) ->where(‘company_id’, $this->company_id) ] The code you provided is defining validation rules for the ‘username’ field in a Laravel application. The first rule ‘required’ means that the field is mandatory and must have a value. The second rule

Laravel Unique Validation on Multiple Columns Read More »

Laravel Sanctum in Shorthand

Last Updated on May 1, 2023 by Moh Laravel Sanctum is a package that provides a lightweight authentication system for single-page applications (SPA), mobile applications, and simple, token-based APIs. As of the latest version of Laravel (8.x) which includes Sanctum (2.x), it provides the following methods: Auth::user() – Retrieves the currently authenticated user. Auth::id() –

Laravel Sanctum in Shorthand Read More »