This is demo rest-api for some online news website or application. It consist some basics operation, and because it's only demonstrative project it have some missing parts.
Just for purpose of testing, creating user is not authorized!
This project have 3 kind of users:
- visitor
- author
- admin
Visitor can manipulate with comments and haven't got any other permissions. Admin can manipulate with users(get all users list, specific user, delete user), also can do some operations with posts(publish, recommend, unrecommend, suggest changes...). Author can only make posts and provide requested changes.
About this project structure as you can see I have divided every entity in separate folders. Base directory consists controller, repository, service and middleware class which will be extended so I use them as a "template" for other classes. All entities are divided in different service providers. All depedency injections are resolved inside service providiers.
-
Manually create a database scheme inside you mysql server.
-
rename .env-example into .env and insert your credentials
-
composer install -> install vendor and all depedencies for this project
-
php artisan vendor:publish -> select Tymon\LaravelServiceProvider
-
php artisan jwt:secret -> generate secret key
- php artisan migrate --path=app/User/Migration/ -> create user table
- php artisan migrate --path=app/PostCategory/Migration/ -> create categories table
- php artisan migrate --path=app/Post/Migration/ -> create posts table
- php artisan migrate --path=app/Comment/Migration/ -> create comments table
- php artisan migrate -> create notifications table
- php artisan db:seed --class=UserSeeder -> seed users table
- php artisan db:seed --class=PostCategorySeeder -> seed categories table
- php artisan db:seed --class=PostSeeder -> seed post table
- php artisan db:seed --class=CommentSeeder -> seed comment table
postman collection you can download here, postman environment you can download here