Giter Site home page Giter Site logo

packtbooks's Introduction

for use this project follow below command

  1. npm i 2)composer update 3)php artisan migrate 4)php artisan db:seed

for data base there is a SQL file named as

initial step by step instation for creating new application
Step 1: composer create-project laravel/laravel packtbookstore

Migration

  1. php artisan make:model Publisher -mcr
  2. php artisan make:model Author -mcr
  3. php artisan make:model Genre -mcr
  4. php artisan make:model Books -mcr
  5. php artisan migrate

====================== Books Migration File Example START =======================

id(); $table->string("title"); $table->text("description"); $table->unsignedBigInteger("isbn"); $table->string("image"); $table->date("published"); $table->foreignId('publisher_id')->constrained('publishers')->cascadeOnUpdate()->cascadeOnDelete(); $table->foreignId('genre_id')->constrained('genres')->cascadeOnUpdate()->cascadeOnDelete(); $table->foreignId('author_id')->constrained('authors')->cascadeOnUpdate()->cascadeOnDelete(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('books'); } }; ====================== Books Migration File Example END ======================= After Generating Migsration and Creating Tables in DB we can use Laravel Seeder for Testing Data => php artisan make:seeder Author => php artisan make:seeder Genre => php artisan make:seeder Publisher => php artisan make:seeder Books ====================== Books Seeder Example START ===================== insert([ 'title' => $faker->title, 'description' => $faker->paragraphs($nbSentences = 3, $variableNbSentences = true), 'isbn' => $faker->isbn13, 'image' => $faker->image, 'published' => date('Y-m-d H:i:s'), 'genre_id' => $faker->numberBetween($min = 1, $max = 20) , 'author_id' => $faker->numberBetween($min = 1, $max = 20), 'publisher_id' => $faker->numberBetween($min = 1, $max = 20), 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s'), ]); } // } } ====================== Books Seeder Example END =====================

packtbooks's People

Contributors

jayramin avatar

Watchers

 avatar

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.