-
Notifications
You must be signed in to change notification settings - Fork 3
Development
Schuyler Cebulskie edited this page Nov 26, 2024
·
4 revisions
The development environment uses Laravel Sail, a containerized environment with a script and easy-to-use commands for interacting with it.
Copy .env.example
to .env
:
cp .env.example .env
After doing so, update the values only as needed. The important ones that will most likely need to be filled in are the ConCat and Telegram items.
- Create a ConCat account on your ConCat instance for OAuth and ensure it has developer authorization.
- Add a new OAuth App at Housekeeping -> Developers -> OAuth Applications -> Create New
- Use
http://localhost
for the callback URL - Select the
registration:read
andvolunteer:read
application permissions
- Use
- Update
CONCAT_CLIENT_SECRET
andCONCAT_CLIENT_ID
in.env
- Create a bot via @BotFather (
/newbot
) - Update
TELEGRAM_BOT_TOKEN
in.env
- Install the PHP CLI for your environment (ex:
sudo apt install php-cli
) - Install Composer
- Run
composer install
in the application directory -
(Optional) Add
sail
alias withalias sail='[ -f sail ] && sh sail || sh vendor/bin/sail'
- It would probably be a good idea to add this to your shell startup script (ex:
~/.bashrc
)
- It would probably be a good idea to add this to your shell startup script (ex:
Whenever using a Sail command, if you don't have an alias setup, use sh vendor/bin/sail
instead of sail
.
- To run the container, use
sail up
(Ctrl+C to stop) -
If this is the first time the env has been run:
- Run
sail artisan key:generate
(UpdatesAPP_KEY
in.env
) - Run
sail npm install
- Initialize the database schema with
sail artisan migrate
-
(Optional) Seed the database with dummy accounts with
sail artisan db:seed
- Run
- To run the Vite server, use
sail npm run dev
(Ctrl+C to stop) - Open the project on http://localhost (it may be slow)
- If you see an Apache/nginx/etc. splash screen, ensure you don't already have a web server bound to port 80.
- Using
php artisan tinker
orsail artisan tinker
will present a PHP REPL with the application bootstrapped, allowing you to mess with any part of the application and see the result of code in real-time. See the Artisan documentation for more information. - The helpers
dump(...)
anddd(...)
can be extremely helpful for debugging the application. The former pretty-prints a representation of any data passed to it with full HTML formatting, and the latter does the same but also immediately halts further execution of the application. Collections and Carbon instances also have->dump()
and->dd()
methods. - Use
php artisan make:migration
orsail artisan make:migration
to create a new database migration. See the migrations documentation for more information. - The Laravel documentation and API documentation will be very helpful if you're not already familiar with the framework.
- Running
composer run format
andnpm run format
will format all PHP and JavaScript code, respectively. - Running
npm run lint
will lint all JavaScript code, checking for common errors and making recommendations.-
npm run lint:fix
will automatically apply fixes for many of these. -
npm run lint:fix-unsafe
will correct even more, but these changes should be manually verified.
-