Posts

Showing posts with the label Laravel

Laravel and Angular: Creating a Full-Stack CRUD Application

Image
To build a full-stack application using Laravel (PHP backend) and Angular (frontend), we will implement a basic CRUD (Create, Read, Update, Delete) application. In this example, the backend will manage a list of users, and the frontend will interact with this backend via HTTP requests. Step 1: Backend - Laravel 1.1 Install Laravel First, create a new Laravel project using Composer. composer create - project --prefer-dist laravel/laravel laravel-angular-crud After installing, navigate to the project directory: cd laravel-angular-crud 1.2 Set Up Database Create a MySQL database (e.g., laravel_angular_crud ) and update the .env file in the root of your Laravel project to reflect the database connection. DB_CONNECTION =mysql DB_HOST = 127.0 . 0.1 DB_PORT = 3306 DB_DATABASE =laravel_angular_crud DB_USERNAME =root DB_PASSWORD = Run the migration to set up the default tables (optional, for user authentication): php artisan migrate 1.3 Create a Model and Migration for Users Now, we’ll...

AWS S3 + Laravel - File Upload, Download, List, and Delete Example

Image
Here’s how you can implement AWS S3 file upload, download, list, and delete functionalities in a Laravel application step-by-step. 1. Setting Up AWS S3 1. Create an AWS Account: If you don't have one, sign up for an AWS account. 2. Create an S3 Bucket: Log in to the AWS Management Console. Navigate to the S3 service. Click "Create bucket." Provide a unique bucket name and choose an appropriate region. Configure access permissions as needed (e.g., public or private). 2. Install AWS SDK for Laravel Install the AWS S3 package via Composer: composer require league/flysystem-aws- s3 - v3 "^3.0" 3. Configure AWS S3 in Laravel 1.  Set up environment variables in the .env file: AWS_ACCESS_KEY_ID =your-access-key AWS_SECRET_ACCESS_KEY =your-secret-key AWS_DEFAULT_REGION =your-region AWS_BUCKET =your-bucket-name 2. Update config/filesystems.php to include the S3 configuration: 'disks' => [ 's3' => [ 'driver' =>...