Is this a good way to setup a laravel project?
composer create-project laravel/laravel [project_name]
Then, navigate into the newly created project directory:
php artisan install:api # (If prompted, feel free to answer: no)
php artisan migrate:reset
Delete the contents of the database/migrations directory.
.env settings — these may depend on your XAMPP/PhpMyAdmin configuration (e.g., port number, user, password):
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=webvill DB_USERNAME=root DB_PASSWORD=
Create a model, controller, and migration with:
php artisan make:model -mc --api [Name]
Start the development server:
php artisan serve
In routes/api.php — define your routes without the /api prefix!
All requests should use URLs like:
http://localhost:8000/api/something
I tried this method, but I’m not sure it’s working correctly.