Online Database with laravel needs classes?

Clash Royale CLAN TAG#URR8PPP
Online Database with laravel needs classes?
I have a complete database hosted and I want to integrate it into my laravel new project. All I know is how to change the env file and I did so. There is a couple of questions though:
Does using online database with laravel need creating classes?
What should I add to the env file? This from my env file:
DB_CONNECTION=MySQL
DB_HOST=(my server IP)
DB_PORT=3306
DB_DATABASE=name
DB_USERNAME=done
DB_PASSWORD=done
What else should I add and where?
1 Answer
1
If you are using Laravel with Database you have to specify which database you want to connect (Live/Local). You can configure your database credentials in .env and database.php inside config folder.
Most preferred way is by using .env from the root directory/folder. Doing this it will be easier for deploying in multiple instances like UAT, PROD, etc.
Comming back to your questions:
The answer is Yes and No.
NO: If you want to use Laravel Query Builder.
YES: If you want to use Elloquent ORM.
I personally prefer using Elloquent ORM instead of writing lots of dirty join query and beyond. Once you get the hang of it, you will never step away from Elloquent ORM. It take a bit of time to learn but worth the time you will invest.
I think you are good with your current .env
Good luck and happy learning.
You can create manually or using the artisan command. It is easier if you use artisan as the boilerplate are generated for you. the command is 'php artisan make:model yourmodelnamehere'
– Gabriel
Aug 13 at 5:02
Thank you very much
– Mohamed Ali Nakouri
Aug 13 at 10:38
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Thank you very much for your detailed answer . So I have to create them manually? I mean the classes
– Mohamed Ali Nakouri
Aug 12 at 16:26