承接 dgvai/laravel-demo-mode 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

dgvai/laravel-demo-mode

Composer 安装命令:

composer require dgvai/laravel-demo-mode

包简介

Your Project Protector in Online Markets

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads Daily Downloads composer.lock

This package protects your projects in online market. Sometimes, in markets, the trial users uploads/saves/changes arbitrary informations that destroys the beauty of your project for the next visitors. This package comes to play in those cases.

Contents

Installation

You can install the package via composer:

    composer require dgvai/laravel-demo-mode

Publish Configuration

Publish configuration file

    php artisan vendor:publish --tag=demomode

For users bellow laravel < 5.5 Add service provider to config/app.php

    "DGvai\DemoMode\DemoModeServiceProvider"

Setup and configure

    /**
         * ENABLE DEMO MODE?
         * ------------------------
         * Use from true to enable demo 
         * mode for your production env
         * 
         */

        'enabled' => env('DEMO_ENABLED',true),

        /**
         * CUSTOM FLASH VARIABLE
         * ------------------------
         * If you want to use custom flash
         * alerts like, realrashid/sweetalert2 
         * has toast_error, success, etc flash 
         * variables to show alert, then use it
         * here.
         * 
         */

        'flash' => 'demo_info',

        /**
         * CUSTOM MESSAGE
         * ------------------------
         * If you want to show a custom flash 
         * message to the users, set it here.
         * 
         */
        
        'msg' => 'Further action is disabled in demo mode!'

After Done Configuration

    php artisan config:cache

Usage

Simply use a middleware demo to the routes you want to protect. Such has save routes.

    Route::post('/save',function(){
        ....
        return 'Furthur Actions';
        ...
    })->middleware('demo')->name('save');

To show the flash message, like an alert, into your view:

    @if(session()->has('demo_info'))
    <div class="alert alert-warning">
        {{session()->get('demo_info')}}
    </div>
    @endif

Or if you have used any custom flash, like realrashid/sweetalert2 has toast_success flash, it will automatically show the toast.

Changelog

Please see CHANGELOG for more information what has changed recently.

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固