WhatNow is a web application built with Laravel 5.8 and Vue.js, designed to provide a disaster preparedness guide. This document includes steps to install and configure the project in your development environment.
Ensure the following tools are installed on your system:
- PHP (version 7.4):
php -v
- Composer (dependency manager for PHP):
composer --version
- Node.js (recommended version 12 or higher):
node -v
- npm (Node.js package manager):
npm -v
- MySQL (version 5.7 or higher):
mysql --version
-
Clone the Repository
git clone https://github.com/YourUsername/WhatNow.git cd WhatNow
-
Install PHP Dependencies
composer install
-
Install JavaScript Dependencies
npm install
-
Set Up Environment
- Copy the
.env
example file and configure it as your environment file:cp .env.example .env
- Generate an application key for Laravel:
php artisan key:generate
- Copy the
-
Database Configuration
- Create a MySQL database named
homestead
. - Open the
.env
file and update your database credentials:
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=homestead DB_USERNAME=your_username DB_PASSWORD=your_password
- Create a MySQL database named
-
Run Database Migrations
php artisan migrate
Optional: If you would like to populate the database with initial sample data, you can run the database seeder command:
php artisan db:seed
-
Compile Frontend Assets
- For development:
npm run hot
- For production:
npm run production
- For development:
-
Start the Development Server
php artisan serve
Command | Description |
---|---|
php artisan serve |
Starts the local development server |
npm run hot |
Compiles assets and hot-reloads changes |
npm run production |
Compiles assets for production |
php artisan migrate |
Runs database migrations |
php artisan db:seed |
Seeds the database with sample data |
php artisan make:model |
Creates a new Eloquent model |
php artisan make:controller |
Creates a new controller |
- Verify Dependencies: Ensure all dependencies are properly installed.
- Environment File: Check that the
.env
file is correctly set up. - Dependency Conflicts: If issues arise, run
composer update
andnpm install
to resolve them. - Database Connection: Verify that the database credentials in the
.env
file are correct. - Migrations: If migrations fail, check the database connection and run
php artisan migrate:refresh
. - Frontend Assets: If assets are not compiling, run
npm run production
ornpm run hot
to recompile them. - Development Server: If the server fails to start, check the port and run
php artisan serve
again.
Run tests using phpunit
. (Note: Tests may require review and adjustments to function properly.)
./vendor/bin/phpunit