Model factories offer a very convenient way to add test data to our database during the development phase. Let's create a factory for our Company's table now.
Eloquent Accessors & RESTful Controller - Part 1
It’s time for us to tackle a refactor of our controllers and views to implement a RESTful controller approach. Follow along as we implement the index, create and store methods in our controller and properly store our views, following the same approach. As a last bit, let’s write an accessor for our active column for better display.
Eloquent BelongsTo & HasMany Relationships
In this episode, we are starting out by reviewing what we have learned so far to create a company model and migration. For new content, we are tackling connecting the company to a customer using the belongsTo and hasMany eloquent relationship.
Eloquent Scopes & Mass Assignment
Up next, let's clean up our controller by extracting the logic for fetching an active/inactive customer into a scope. Then, let's use validated data to create our new customers using the create() method.