GithubHelp home page GithubHelp logo

faq-pack's Introduction

FAQ Package APIs with Lumen 5.5

Installation & Usage

You can install the package via Composer:

composer require nikunjkumar.kabariya/faq

Run

composer dump-autoload --optimize

Create blank config folder on root of your application if not exist.

Copy the required files:

cp vendor/nikunjkumar.kabariya/faq/src/config/faq.php config/faq.php
cp vendor/nikunjkumar.kabariya/faq/src/routes/routes.php routes/faq.php

Modify the bootstrap flow (bootstrap/app.php file) & Register service provider

// Enable Facades
$app->withFacades();

// Enable Eloquent
$app->withEloquent();
$app->register(Nikunjkabariya\Faq\FaqServiceProvider::class);

Now, run your migrations:

php artisan migrate

Installed routes

This package mounts the following routes after you call routes() method (see instructions below):

Verb Path NamedRoute Controller Action Middleware
GET /api/faq/list \NikunjKabariya\Faq\FaqController index admin_api
GET /api/faq/show/{id} \NikunjKabariya\Faq\FaqController show admin_api
POST /api/faq/create \NikunjKabariya\Faq\FaqController store admin_api
DELETE /api/faq/delete/{id} \NikunjKabariya\Faq\FaqController destroy admin_api
PUT /api/faq/update/{id} \NikunjKabariya\Faq\FaqController update admin_api
PUT /api/faq/change_status \NikunjKabariya\Faq\FaqController changeStatus admin_api
GET /api/faq_topic/list \NikunjKabariya\Faq\FaqController faqTopicList -
GET /api/faqs/{faqTopicSlug} \NikunjKabariya\Faq\FaqController getAllFaqsByFaqTopic -

Extend / Add new fields

Copy these files in your application if not exist:

  • config/faq.php

  • routes/faq.php

  • create new migration file in your application, for ex.:

    php artisan make:migration add_featured_image_in_faqs_table --table=faqs
    

    then, run this command

    php artisan migrate
    
  • If you want to keep validation for new fields, you can do it in your application's faq config file,

    config/faq.php file  
    
  • You can modify package's route in your application's faq route file, you can add/change prefix, groups, namespace, middleware etc. If you override method in controller then make sure to change namespace for that particular route in this file.

    routes/faq.php file  
    
  • If you want to override any existing method or want to create new method, you can do it by extending FaqController.php from your application's new controller. for ex.:

    use Nikunjkabariya\Faq\FaqController as FaqControllerPackage;
    class FaqController extends FaqControllerPackage {}

    You can also override / create new method by extending Faq.php model file from your application's new model. for ex.:

    use Nikunjkabariya\Faq\Faq as FaqModel;
    class Faq extends FaqModel {}

faq-pack's People

Contributors

nikunjkabariya 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.