定制 rlustosa/laravel-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rlustosa/laravel-generator

Composer 安装命令:

composer require rlustosa/laravel-generator

包简介

Laravel Module management for my projects

README 文档

README

Build Status Total Downloads Latest Stable Version License

About Laravel Generator

rlustosa/laravel-generatoris a Laravel package which created to manage your large Laravel app using modules.

Install

To install through Composer, by run the following command:

composer require rlustosa/laravel-generator:dev-master
composer remove rlustosa/laravel-generator && composer require rlustosa/laravel-generator:dev-master -vvv
composer require rlustosa/laravel-generator:~0.0.2

The package will automatically register a service provider and alias.

Optionally, publish the package's configuration file by running:

php artisan vendor:publish --provider="Rlustosa\LaravelGenerator\LaravelGeneratorServiceProvider"

Autoloading

By default the module classes are not loaded automatically. You can autoload your modules using psr-4. For example:

{
  "autoload": {
    "psr-4": {
      "App\\": "app/",
      "Modules\\": "Modules/"
    }
  }
}

Tip: don't forget to run composer dump-autoload afterwards.

Preparing to Vue

1 - Install JS packages with:

- composer require laravel/ui --dev
- php artisan ui bootstrap
- php artisan ui vue
- npm install
- npm install @ckeditor/ckeditor5-build-classic @ckeditor/ckeditor5-vue coffee-script luxon v-money vue-awesome-notifications vue-datetime": "^ vue-filter-date-format vue-filter-date-parse vue-i18n vue-router vue-select vue-the-mask vuejs-datepicker vuejs-loading-plugin vuex weekstart --save-dev

2 - Modify resources/js/app.js to:

/**
 * First we will load all of this project's JavaScript dependencies which
 * includes Vue and other libraries. It is a great starting point when
 * building robust, powerful web applications using Vue and Laravel.
 */

require('./bootstrap');

/**
 * Next, we will create a fresh Vue application instance and attach it to
 * the page. Then, you may begin adding components to this application
 * or customize the JavaScript scaffolding to fit your unique needs.
 */
import Vue from "vue";
import Routes from "./router";
import App from "./components/App";
import PaginateComponent from "./components/layout/PaginateComponent";
import VueLoading from 'vuejs-loading-plugin'
import VueFilterDateFormat from 'vue-filter-date-format';
import VueFilterDateParse from 'vue-filter-date-parse'
import VueAWN from "vue-awesome-notifications"
import i18n from './i18n';

// overwrite defaults
Vue.use(VueLoading, {
    dark: false, // default false
    text: 'Loading...', // default 'Loading'
    loading: false, // default false
    //customLoader: myVueComponent, // replaces the spinner and text with your own
    //background: 'rgb(47, 64, 80)', // set custom background
    classes: ['loading-screen-inspinia', 'animated', 'fadeIn'] // array, object or string
});

Vue.use(VueFilterDateFormat, {
    dayOfWeekNames: [
        'Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'
    ],
    dayOfWeekNamesNamesShort: [
        'Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'
    ],
    monthNames: [
        'Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho',
        'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'
    ],
    monthNamesShort: [
        'Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun',
        'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'
    ]
});

Vue.use(VueFilterDateParse);

Vue.component('paginate-component', PaginateComponent);

let optionsVueAWN = {
    position: "top-right",
    clean: true,
    labels: {
        tip: '',
        info: '',
        success: '',
        warning: '',
        alert: '',
        async: 'Loading',
        confirm: 'Confirmation required',
    },
    icons: {
        enabled: false,
    }
};

Vue.use(VueAWN, optionsVueAWN);

Vue.filter('capitalize', function (value) {
    if (!value) return '';
    value = value.toString();
    return value.charAt(0).toUpperCase() + value.slice(1) + '.....';
});

Vue.filter('currencydecimal', function (value) {
    if (!value) return '-';
    return value.toFixed(2)
});

Vue.filter('fromBoolean', function (value) {
    return value == 1 ? 'Yes' : 'No';
});

const app = new Vue({
    i18n,
    el: '#app',
    router: Routes,
    render: h => h(App),
    data() {
        return {
            componentKey: 0,
            viewKey: 1
        };
    },
    methods: {
        scrollToTop() {
            window.scrollTo({
                top: 0,
                left: 0,
                behavior: 'smooth'
            });
        },
        updateViewKey() {
            this.viewKey += 1;
        }
    }
});

$('#app').tooltip({
    selector: "[data-toggle=tooltip]",
    container: "body"
});

$('.popover-dismiss').popover({
    trigger: 'focus'
});


3 - Create resources/js/router.js with:

import Vue from "vue";
import VueRouter from "vue-router";
import DashboardComponent from "./components/dashboard/DashboardComponent";
import NotFoundComponent from "./components/NotFoundComponent";

Vue.use(VueRouter);

const router = new VueRouter({
    mode: "history", // hash history abstract
    routes: [
        {
            path: "/",
            name: "dashboard",
            component: DashboardComponent,
            meta: {
                auth: true
            }
        },
        {
            name: 'not-found',
            path: '/not-found',
            component: NotFoundComponent,
        },
        {
            path: '*',
            redirect: '/not-found',
        }
    ],
    scrollBehavior(to, from, savedPosition) {
        return {x: 0, y: 0};
    }
});

router.beforeEach((to, from, next) => {
    console.info(to.meta.auth ? 'Precisa estar logado' : 'Não Precisa estar logado');
    /*if (to.meta.auth) {
        return router.push({name: 'login'});
    }*/
    next();
});

export default router;

4 - App.vue example:

<template>
    <div id="wrapper">
        <router-view/>
    </div>
</template>

<script>
    export default {
        name: "App",
        mixins: {},
        components: {},
        data() {
            
        },
    }
</script>

<style scoped>

</style>

5 - Configure your web.php:

Route::get('/{any}', 'PanelController@index')->where('any', '^(?!api).*$');

Route::get('/', function(){
    return view('errors.500');
})->name('login');

6 - Configure your PanelController.php:

namespace App\Http\Controllers;


class PanelController extends Controller
{
    public function index() {
        return view('panel');
    }
}

7 - Configure your initial view:

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>Laravel</title>
    <link href="{{ mix('/css/app.css') }}" rel="stylesheet">
</head>

<body>

<div>
    <v-app id="app">

    </v-app>

</div>

<script src="{{ mix('/js/app.js') }}"></script>

</body>
</html>

8 - See commands:

php artisan rlustosa

9 - After generating a module, add the service provider in the providers section of config/app.php

USEFUL COMMANDS

  • php artisan rlustosa:make-module product product --force && chmod 777 -R ./ Gerar Módulo completo
  • php artisan rlustosa:make-code product product -s --force && chmod 777 -R ./ Gerar Scaffold de código
  • php artisan rlustosa:make-code product product -c --force && chmod 777 -R ./ && npm run watch Gerar os ".Vue" funcionais

Documentation

You'll find installation instructions and full documentation on ###########.

Credits

TODO

  • Atualizar arquivo de rotas do Laravel (Atualmente está sendo sobrescrito)
  • Gerar views html

About Rupert Brasil Lustosa

Rupert Lustosa is a freelance web developer specialising on the PHP and Laravel framework ############.

License

The MIT License (MIT). Please see License File for more information.

rlustosa/laravel-generator 适用场景与选型建议

rlustosa/laravel-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 129 次下载、GitHub Stars 达 2, 最近一次更新时间为 2019 年 12 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 rlustosa/laravel-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 rlustosa/laravel-generator 我们能提供哪些服务?
定制开发 / 二次开发

基于 rlustosa/laravel-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 129
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-12-02