Skip to main content

Setting up laravel

The Sample Application

This book will use a sample application. We will build upon a simple blog application - everybody’s
favorite weekend learning project.
The application is viewable on Github at fideloper\Implementing-Laravel5. There you can view code
and see working examples from this book.
Here is an overview of some information about the application.


Database

We’ll have a database with the following tables and fields:


  • articles - id, user_id, status_id, title, slug, excerpt, content, created_at, updated_at, deleted_at
  • statuses - id, status, slug, created_at, updated_at
  • tags - id, tag, slug
  • articles_tags - article_id, tag_id
  • users - id, email, password, created_at, updated_at, deleted_at


You’ll find migrations for these tables, as well as some seeds, in the app/database/migrations
directory on Github.


Models

Each of the database tables will have a corresponding Eloquent model class, inside of the app/models
directory.

models/Article.php
models/Status.php
models/Tag.php
models/User.php


Relationships

Users can create articles and so there is a “one-to-many” relationship between users and articles;
Each user can write multiple articles, but each article only has one user. This relationship is created
within both the User and Article models.
Like users, there is a “one to many” relationship between statuses and articles - Each article is
assigned a status, and a status can be assigned to many articles.
Finally, the Articles and Tags have a relationship. Each article can have one or many tags. Each tag
can be assigned to one or many articles. Therefore, there is a “many to many” relationship between
articles and tags. This relationship is defined within the Article and Tag models, and uses the
Articles_Tags pivot table.


Testability and Maintainability

I’ll use the phrase “testable and maintainable” a lot. In most contexts, you can assume:
1. Testable code practices SOLID principles in a way that allows us to unit test - to test one
specific unit of code (or class) without bringing in its dependencies. This is most notable in
the use of Dependency Injection which directly allows the use of mocking to abstract away
class dependencies.
2. Maintainable code looks to the long-term cost in development time. This means that making
changes to the code should be easy, even after months or years. Popular examples of a
change that should be easy is switching out one email provider for another or one data-store
for another. This is most di

Popular posts from this blog

menggunakan API blogspot di gridsome vue js

yuk berbagi lagi sesuai dengan judul artikel ini, kali ini saya akan berbagi tentang bagaimana cara menggunakan API blogspot, dan menggunakan data dari API blogspot tersebut di aplikasi yang kita buat menggunakan gridsome.

error source-filesystem saat upgrade gridsome

assalamualaikum halo semuanya kali ini ane mau share sedikit error pada saat ane upgrade gridsome versi 0.4 ke versi 0.6. awalnya sih setelah beberapa minggu nggak update tulisan, ada inisiatif untuk membuka website official gridsome dan ternyata untuk latest version sudah sudah versi 0.6, hmm ugrade ah. untuk temen" yang ingin upgrade gridsome tinggal menjalani perintah seperti ini mengunakan yarn  yarn upgrade gridsome --latest mengunakan npm   npm install gridsome@latest setelah menjalankan perintah tersebut makan otomatis akan mengupgrade versi gridsome ke versi yang terbaru. nah setelah ini juga akan mucul beberapa error salah satunya yaitu perubahan query graphql  coverImage menjadi cover-image. yang terakhir adalah akan terjadi error di library filesystem gridsome, untuk mengatasi error ini silah teman" tinggal upgrade source-filesystem gridsome seperti ini: " @gridsome/source-filesystem " : " ^0. 3 .0 " , " @gridsome/s...
Iran Buka Blokir Akses Gmail Teheran - Setelah sempat memblokirnya, Iran membuka kembali akses Gmail. Namun Komite Sensor Internet Iran menyebutkan, sensor tambahan tengah dipersiapkan untuk menyaring konten YouTube. Laporan yang dilansir AFP dan dikutip detikINET, Senin (1/10/2012), para pengguna internet di Iran melaporkan telah bisa kembali mengakses akun Gmail mereka sejak diblokir pada 24 September. Pencarian Google versi secure atau HTTPS pun sudah bisa diakses setelah diblokir pada waktu yang sama. Sementara itu, pencarian Google versi unsecure atau HTTP tidak pernah diblokir. Pekan lalu, sekretaris lembaga pengawasan konten nasional Iran Abdolsamad Khoramabadi mengatakan, Google dan Gmail akan disaring hingga ada pemberitahuan lebih lanjut. Namun Mohammad Reza Miri, anggota komite kementerian telekomunikasi Iran mengatakan blokir Gmail merupakan akibat tidak disengaja dari upaya menerapkan sensor pada YouTube.  "Sayangnya, kami belum memiliki pe...