yangze/laravel-modules-helper

some command help for caffeinated/modules

v0.1.7 2019-12-17 16:08 UTC

This package is auto-updated.

Last update: 2024-11-09 00:02:47 UTC


README

this is a package for creating restful api with nwidart/laravel-modules, the first version is aim to create restful api in modules.

Quick Installation

Begin by installing the package through Composer.

composer require yangze/laravel-modules-helper

Once this operation is complete, simply add both the service provider and facade classes to your project's config/app.php file:

Service Provider

Yangze\ModulesHelper\ModulesHelperServiceProvider::class,

publish tag

php artisan vendor:publish --tag Yangze\ModulesHelper\ModulesHelperServiceProvider

Command list

Usage

  1. create modules, such as Common
php artisan make:module Common
  1. create restfull api

before you create the api, you shoule make sure the model is exists.

php artisan module:api common Api/CommonNewsController --model App\\Models\\CommonNews
  1. add route to the api.php

in my website is app/Modules/Common/Routes/api.php,you should choose the right module.

Route::resource('common/news', 'CommonNewsController');
  1. test the restful api