Git Product home page Git Product logo

laravel-relationships-data's Introduction

Laravel Relationships Data

This repo contains the migrations, seeders and factories to get up and running with various relationships types data quickly. Laravel provides support for many types relationships out-of-the-box. And when there is a need to play with any one of them to test something, I hate repeating the same stuff of creating migration and seeding the data before I can write code to actually test something.

Here's how relationships are put here:

Relationship Type Model 1 Model 2
One to One User Post
One to Many Post Comments
Many to Many User Role
Has Many Through Country Phone
Polymorphic Post/Video Like
Many to Many Polymorphic Post/Video Tag

And here is the ER Diagram image generated with this lovely package by Marcel Pociot.

Laravel Relationships Data

Laravel Nova Scaffolder

This repo also contains the necessary resource classes for each of the models to manage all the entities from the powerful Laravel Nova admin panel. Following are the steps to get you there in a few minutes:

  1. Clone the repo:
git clone https://github.com/freshbitsweb/laravel-relationships-data.git [DIRECTORY_NAME]
  1. Create .env file from the example file:
composer run-script post-root-package-install
  1. Setup .env variables (Mainly the Database details and App URL)

  2. Install the dependencies and run migrations + seeders

composer install
composer run-script post-create-project-cmd
php artisan migrate --seed
  1. Install Laravel Nova

  2. Head over to [APP_URL]/nova. You will see something like this on the post details page for example.

Laravel Nova Post Details Page

laravel-relationships-data's People

Contributors

gauravmak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

laravel-relationships-data's Issues

many to many relationship

hi @gauravmak

can i use 4 foreign key in middle table in many to many relationship?

for example:

users table =>
id
name
email

languages table =>
id
name

fields table =>
id
name

field_language_user_table => middle table
field_id
user_id
from_language
to_language

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.