This repository is used to benchmark how Laravel Eloquent handles a database view for a model compared to a normal table.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
bootstrap
config
database
public
resources
routes
storage
tests
.editorconfig
.env.example
.gitattributes
.gitignore
README.md
artisan
composer.json
composer.lock
package.json
phpunit.xml
server.php
webpack.mix.js
yarn.lock

README.md

Benchmark Database views for Laravel Eloquent

This repository is used to benchmark how Laravel Eloquent handles a database view for a model compared to a normal table.

Read the blog post here: https://www.hmazter.com/2018/09/using-database-views-as-tables-for-laravel-eloquent/

Installation

  1. git clone
  2. composer install
  3. copy .env.example and edit .env
  4. php artisan migrate --seed

Usage

Run one of these artisan commands using the unix time command:

fetch-posts-from-table-model  Fetch posts from the table model
fetch-posts-from-table-query  Fetch posts from the table with a query
fetch-posts-from-view-model   Fetch posts from the view model
fetch-posts-from-view-query   Fetch posts from the view with a query

ex:

time php artisan fetch-posts-from-table-model