[Lesson 10] Laravel Eloquent Models (Query Builder)

Опубликовано: 30 Июнь 2020
на канале: Zak H.
1,293
22

#Laravel #LaravelEloquent #LaravelModel
Laravel's Eloquent Models are one of the pillars bolstering up the worlds most popular Php Framework.

In this lesson, we start out by refactoring the current set up we have from the last lesson - our Database Query Builder. We'll refactor the database query build and then continue on to clean up the way we query our data even further by refactoring out the database query build all together in place of an Eloquent Model.



We'll cover how to use artisan to create or make a model, how Eloquent Model's reference our database tables and the associated naming conventions and a few short examples covering how to use Eloquent Models to query the database -- ultimately replacing our current usage of the Database Query Builder with a Laravel Eloquent Model.

~~~~~~~~~~~~~~~~~~~~
Clean Code Studio ~ Simplify!
Clean Code Clean Life
~~~~~~~~~~~~~~~~~~~~
https://cleancode.studio

~~~~~
Github
~~~~~~~~~~~~~~~~~~~
https://github.com/zhorton34

~~~~~~~~~~~~
NpmJS Packages
~~~~~~~~~~~~
https://www.npmjs.com/~zhorton999

~~~~~~~~~~~~~~~~~~~~~
Packagist (Composer) Packages
~~~~~~~~~~~~~~~~~~~~~~
https://packagist.org/users/zhorton34...

~~~~~~
LinkedIn
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  / zak-horton  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Looking for hosting? Three options to consider
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Laravel Forge is my go to for monolithic apps.
https://forge.laravel.com
You'll need a digital ocean or AWS server
Laravel Forge starts at $12/month + the cost of your server
Expect to pay between $25-$50/month with cost variance depending on your server
(Note: Hostgator is the most cost friendly hosting and linked to below).

Laravel Vapor is my go to for Serverless non-monolithic applications
https://vapor.laravel.com
Vapor needs to be connected to an AWS account
Vapor itself will run you $39/month + the cost of your aws cloud infastructure
Apps expecting major traffic needing horizontal scaling capability may want vapor.
Price point: Expect to spend $100/month and be happily suprised if its less. The price for serverless majorly varies based on proper configuration and traffic. If everything is set up properly, and you have a lot of traffic serverless will spend you money. That being said -- it's nothing short of complex. Vapor simplifies the complexity of serverless cloud computing to an extent. Price point for Laravel Vapor per month with Aws setup: $90 to A lot of $/month.

3. Hostgator
https://partners.hostgator.com/24L6D (Aff)
Starts at $2.75/month
Cost-friendly
Begginner friendly
Not as powerful or configurable as Forge or Vapor
Solid hosting provider for small sites like your portfolio
cPanel offered with upgraded plan, also easy to upgrade

1. Laravel Forge: https://forge.laravel.com (Powerful, Beginner friendlyish)
2. Laravel Vapor: https://vapor.laravel.com (Powerful, Serverless scalability)
3. Hostgator: https://partners.hostgator.com/24L6D (Best Cost, Beginner friendly)