The following link is the aws address for this project, http://13.210.14.131/figtest/public/index.php
User Story: 1. The default page is the bloglist page, whether a user login or not, the blogs always show; 2. If a user login, he only can create, update, delete his own blogs; 3. If a user does not login, he only can view blogs. 4. If an admin user login, he can create, update, delete all users blogs.
The admin user's username is admin, user's email is admin@qq.com, password is 12345678. You can use username or email to login
The test user's username is test, user's email is test@qq.com, password is 12345678. You can use username or email to login

This project is built backend by Laravel and frontend by Vue. Users tabls is used MYSQL still, Blogs Table is used MongoDB. Both frontend and backend have been built unittests. Backend unittest is built by phpunit. Frontend unittest is built by Jest. The Laravel passport is included in this project, the whole project uses Repository pattern.

All the base things, you should be read and learn from "https://github.com/ramseyjiang/Repo_Pattern_Laraevl_Passport_Vue_Fullstack/tree/4_Blogs_MongoDB_Users_MySQL" first.

If want to run this project directly, please using the following steps.

Step1: clone the project to your local first.

Step2: composer install

Step3: cp .env.example .env

Step4: php artisan key:generate

Step5: php artisan migrate

Step6: php artisan passport:install

Step7: php artisan db:seed --class UsersTableSeeder

Step8: ./vendor/bin/phpunit (It is used to run php unittests)

If unittests run no issues, it is fine.

Step9: npm install

Step10: npm run dev

Step11: npm run test

If all tests are no issues, it is finished.


If you wanna to learn how to do this project step by step, you can follow steps under below.

This readme only describes how to install and config this project, if you wanna to know the base platform how to build it, please follow this link "https://github.com/ramseyjiang/Repo_Pattern_Laraevl_Passport_Vue_Fullstack/tree/4_Blogs_MongoDB_Users_MySQL"

All steps under below are base on the fullstack you have learnt.

Step0: git clone https://github.com/ramseyjiang/Repo_pattern_laravel_passport_vue_fullstack project_name

Step1: rm -rf .git (It is used to remove all git history.)

Step2: composer install

Step3: cp .env.example .env

Step4: modify the database, root, password in the .env file. modify config/database.php, update the MongoDb config the same with your local.

Step5: php artisan key:generate

Step6: php artisan passport:install

Step7: php artisan migrate

Step8: php artisan db:seed --class UserTableSeeder

Step9: ./vendor/bin/phpunit (To make sure the backend works, then you can use "php artisan app:name AppName" to change app name or not, it is up to you.)

Step10: composer require jenssegers/mongodb

Step11: php artisan make:controller BlogController --resource (It will generate BlogController and some default methods)

Step12: php artisan make:request BlogRequest (It will generate BlogRequest in a requests folder)

Step13: php artisan make:model Models/Log -m (It will generate Log.php within the Models folder and generate a new file in the database/migrations folder, you should fill the table content.)

Step14: php artisan make:model Models/Blog (It will generate a Blog model within the Models folder.)

Step15: php artisan make:policy BlogPolicy (It will generate a BlogPolicy file in the policies folder.)

Step16: php artisan make:observer BlogObserver (It will generate a BlogObserver file in the Observers folder)

Step17: php artisan make:test BlogTest (It will generate a BlogTest file in the tests/Feature folder.)

Step18: create blog/List.vue, blog/Edit.vue in the resources/js/components folder, create blog/List.test.js, blog/Edit.test.js in the resources/js/tests folder

Step19: Update routes.js

After all steps above, you can copy code from each matches file content from this project file.

Run "npm run dev" to compile, after that run "npm run test" to test whether frontend works or not.

If all the above works, this project works. Thanks for your time. If you like this project, please add a star for me. Thanks and cheers.