Jacob
Jacob

Reputation: 187

Setup a database before using Laravel Backpack?

The Laravel Backpack docs seem to assume that users already have a working database from which to query data. Is this assumption accurate, or is there in fact a certain way of building the database using the Backpack resources?

Upvotes: 0

Views: 291

Answers (2)

Wesley Smith
Wesley Smith

Reputation: 19571

Yes, it's expected that you have a database server running somewhere and that you have configured your laravel application to point to that database.

If you look in config/database.php, you'd configure one or more server in the connections array. See the oficial Laravel docs for more details.

Backpack for Laravel, packages it pulls in, and laravel itself offer some "generators" that can be used to help you in your development by creating stubbed out Migration files which are used to add, edit, or remove tables from your configured database and Eloquent Database Modles which are used by your application to interact with those tables.

You don't nessicarily have to have a connected database to generate these files and work on filling in the stubs with details relevant to your application. However, before you can run php artisan migrate to apply the migrations or start actually using the Models to query or store data, you will need to configure that connection to a running database server.

The database server could be one running on your local or remote machine that you set up yourself, something provided by a service like AWS, or even in a virtualized environment like the one provided automatically when using the official Laravel Homestead

With your being new to laravel, Backpack, and maybe php development in general I would highly recommend using Laravel Homestead to develop your application. It's incredibly simple to use and ensures that everything you need to get started is available.

Upvotes: 2

Jacob
Jacob

Reputation: 187

The third video in their tutorial uses Blueprint to generate models and relationships, seemingly instead of using Eloquent.

https://backpackforlaravel.com/docs/4.1/getting-started-videos

Upvotes: 0

Related Questions