Laravel Multilingual Blog
Before you can use this project, make sure you have the following software installed on your machine:
PHP (version 8.0 or higher)
Composer
Node.js (version 14 or higher)
NPM (Node Package Manager)
To download and set up the project, follow these steps:
-
Clone the repository to your local machine using the following command:
git clone https://github.com/imhemayatsangin/laravelMultilingualBlog.git -
Navigate to the project directory:
cd your-repository -
Install the PHP dependencies using Composer:
composer install -
Create a copy of the .env.example file and name it .env:
cp .env.example .env
Or
copy .env.example .env -
Generate an application key:
php artisan key:generate -
Configure the database connection in the .env file. Set the appropriate values for your database server:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_database_username
DB_PASSWORD=your_database_password -
Run the database migrations to create the necessary tables:
php artisan migrate --seed -
Install the JavaScript dependencies using NPM:
npm install -
Go to App/Providers/LanguageServiceProvider.php file and uncomment the following code inside the boot function.
public function boot(): void { // $languages = DB::table('languages')->get();// $config = []; // foreach ($languages as $language) { // $config[$language->code] = [ // 'display' => $language->name, // 'flag-icon' => $language->icon, // ]; // } // config(['languages' => $config]);}
To run the project locally, execute the following command:
php artisan serve
email: admin@blog.com
password: password
This will start a development server at http://localhost:8000, and you can access the application in your web browser.