Skip to main content

Build laravel crud using infyom laravel generator

Installation of Laravel

First you need to install laravel by running below composer commands

   composer create-project laravel/laravel example-app

After creating project run artisan command to initialize development server

   cd example-app

   php artisan serve

Now you can access your application in your web browser at http://localhost:8000


Installing Infyom laravel generator

Now you need to install laravel generator by infyom.

Add following packages into composer.json while using it with Laravel 9.

    "require": {

                 "infyomlabs/laravel-generator" : "^5.0",

                 "infyomlabs/adminlte-templates" : "^5.0"

     }

if you want to use Generate from table option, you need to install

      "require": {

                 "doctrine/dbal" : "^2.3"

     }

After saving changes in composer.json run following command

    composer update

    php artisan vendor:publish --provider="InfyOm\Generator\InfyOmGeneratorServiceProvider"

It will publish the configuration file config/laravel_generator.php


Now you need to publish generator stuff:

    php artisan infyom:publish


This Generator provides various commands to generate scaffolds and APIs just by running commands:

     php artisan infyom:api $MODEL_NAME  

     php artisan infyom:scaffold $MODEL_NAME

     php artisan infyom:api_scaffold $MODEL_NAME

Generate from Table

The best part of this generator is you can generate any module by just creating database table and running below command.

    php artisan infyom:scaffold Post --fromTable --table=posts

You will get whole post module with crud operation after running this command. You can generate more modules using this technique and save your time.


Comments

Popular posts from this blog

Generate Laravel migrations and seeders from an existing database

In conclusion, migrating existing PHP applications to laravel can be a challenging task, perticularly when dealing with large databases and tables. As a developer we need a solution which automates the migration and seeder generation.Thankfully, there are handy packages available to automate the migration and seeder generation processes. For generating migrations, you can utilize the ` kitloong/laravel-migrations-generator ` package. First we will generate migrations from database tables Run below command      composer require --dev kitloong/laravel-migrations-generator Running below command will generate migrations for all tables           php artisan migrate:generate If you want to create migrations for specific tables then use below command           php artisan migrate:generate --tables="table1,table2,table3" You can also ignore some tables using           php artisan migrate:g...

Introduction Of Laravel

Laravel is a PHP based web framework for building high-end web applications using its significant and graceful syntaxes. It comes with a robust collection of tools and provides application architecture. Moreover, it includes various characteristics of technologies like ASP.NET MVC, CodeIgniter, Ruby on Rails, and many more. This framework is an open-source framework. It facilitates developers by saving huge time and helps reduce thinking and planning to develop the entire website from scratch. Along with that, the security of the application is also taken care of by Laravel. So all its features can increase the speed of web development for you. If you are familiar with intermediate PHP scripting and PHP basics, Laravel can prepare your work more efficiently. The current version of Laravel is  9 , which is a stable release, released on  February 8, 2022 . And anyone can check its open-source GitHub repository from this link below: https://github.com/laravel/framework Laravel Fa...