Slim 4 Authentication (Lesson 10: Database Migrations, Seeds, & Factories)

preview_player
Показать описание
#Slim4Authentication #Slim4Migrations #Slim4Database

Alright, this one is going to be exciting ~ we're going to set up database migrations, seeds, and factories.

Database Migrations allows us to control the structure of our database within our codebase. Database Seeders allows us to populate our database with data without needing to manually add the data. Factories will allows us to create dummy or faker instances of our Eloquent Models. We will still be able to custom values and override faker data, but by default all we'll have to do to create a dummy instance is run

factory(User::class, 5)-create([
'first_name' = 'hard coded first name overriding faker created first name'
])

Let's dive in and really improve our lives as developers and engineer, setting up an environment that is truly enjoyable to work with!

~~~~~~~~~~~~~~~~~~~~
Clean Code Studio ~ Simplify!
Clean Code Clean Life
~~~~~~~~~~~~~~~~~~~~

~~~~
Database Migrations/Seeds Package
~~~~~~~

~~~~
Faker Data package for factories
~~~~~

~~~~~
Github Repository
~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~
Npm JS Packages
~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~
Packagist (Composer) Packages
~~~~~~~~~~~~~~~~~~~~~~

~~~~~~
LinkedIn
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Рекомендации по теме
Комментарии
Автор

Hi, great TutorialSeries so far, but on suggestion: replace fzaninotto/faker with fakerphp/faker because fzaninotto/faker is abandond / archived by its author and fakerphp is its drop in replace (fork of the original by laravel) :)

markusmoeller
Автор

Hi! Thank you for great tutorial! Things i thought was very complex you made look clear, and understandable.
In this chapter i understand what this factories for, but i can't follow this realization in slim. Maybe you could recommend some resources to learn more about how Factories work with Eloquent and Illuminate in Slim?
And if i need to create new table, let's say Product - is it the right way always use factory to add a new product?
Thanks! This series is really inspiring!

sz
Автор

"Fatal error: Uncaught Error: Call to a member function connection() on null in occurs :-(

P.S. In class FactoryMakeOrCreate, in methods create and make $model::forceCreate and $model::make doesn't exist in Illuminate\Database\Eloquent\Model, BUT can be found in

Tivew