An exercise project for Laravel (v8) Framework.
This project is a simple note management system where users can save their notes after registering. It is also possible to categorize the notes into different categories and adding some tags to each note.
this project using:
- Laravel Sail and it has a Docker container.
- Laravel Livewire for it's front-end components.
- Laravel Jetstream for authentication.
- MySql Database.
because this project using Laravel Sail you can run this project with sail commands or installing required packages locally.
for running the project via Laravel Sail do the following steps (based on Laravel Sail Documentation):
- clone the project and cd into it
- install required php packages by running:
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/opt \
-w /opt \
laravelsail/php80-composer:latest \
composer install --ignore-platform-reqs
- create
.env
file:
cp .env.example .env
- install and run docker containers:
./vendor/bin/sail up -d
you can use an alias for ./vendor/bin/sail
to execute Sail's commands more easily. for more information see Laravel Documentation for sail alias.
- install npm packages:
./vendor/bin/sail npm install
- generate project key:
./vendor/bin/sail artisan key:generate
- migrate (and seed) the database:
./vendor/bin/sail artisan migrate --seed
- open browser and go to http://localhost (or use this url for api).
- for stop the program go to the project's root folder and run:
./vendor/bin/sail down
- first, goto home page (http://localhost) and register into the program.
- then, in the dashboard page, click on upper right icon and go to API Tokens page
- Create a new API Token by setting it's name and it's permissions.
- after that, a message must be shown to you that contain your API token. copy it and close the message.
- when you want to use the program api, add following header to your request.
Authorization: Bearer <your api token>
The following routes are available in the program's api:
Method | URI | Action |
---|---|---|
GET|HEAD | api/user | Closure |
GET|HEAD | api/notes | App\Http\Controllers\NoteController@index |
POST | api/notes | App\Http\Controllers\NoteController@store |
GET|HEAD | api/notes/{note} | App\Http\Controllers\NoteController@show |
PUT|PATCH | api/notes/{note} | App\Http\Controllers\NoteController@update |
DELETE | api/notes/{note} | App\Http\Controllers\NoteController@destroy |
GET|HEAD | api/categories | App\Http\Controllers\CategoryController@index |
POST | api/categories | App\Http\Controllers\CategoryController@store |
GET|HEAD | api/categories/{category} | App\Http\Controllers\CategoryController@show |
PUT|PATCH | api/categories/{category} | App\Http\Controllers\CategoryController@update |
DELETE | api/categories/{category} | App\Http\Controllers\CategoryController@destroy |
GET|HEAD | api/tags | App\Http\Controllers\TagController@index |
POST | api/tags | App\Http\Controllers\TagController@store |
GET|HEAD | api/tags/{tag} | App\Http\Controllers\TagController@show |
PUT|PATCH | api/tags/{tag} | App\Http\Controllers\TagController@update |
DELETE | api/tags/{tag} | App\Http\Controllers\TagController@destroy |