定制 kohkimakimoto/laravel-message-binder 二次开发

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

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

kohkimakimoto/laravel-message-binder

Composer 安装命令:

composer require kohkimakimoto/laravel-message-binder

包简介

A little hack for Illuminate View to access flash messages easily.

README 文档

README

A little hack for Illuminate View to access flash messages easily.

You can use the withMessages method like a laravel builtin method withErrors in a general purpose.

Route::get('register', function()
{
    return View::make('user.register');
});

Route::post('register', function()
{
    $rules = array(...);

    $validator = Validator::make(Input::all(), $rules);

    if ($validator->fails())
    {
        return Redirect::to('register')->withErrors($validator);
    }

    // You can use the `withMessages` method like a laravel builtin method `withErrors` in a general purpose.
    return Redirect::to('register')->withMessages(array('default' => 'Success!');
});

After redirection, you may utilize the automatically bound $messages variable in your view:

<?php echo $messages->first('default'); ?>

see also laravel docs#validation

Installation

Add dependency in composer.json

"require": {
    "kohkimakimoto/laravel-message-binder": "0.*"
}

Run composer update command.

$ composer update

Add MessageBinderServiceProvider to providers array in app/config/app.php

'providers' => array(
    ...
    'Kohkimakimoto\MessageBinder\MessageBinderServiceProvider',
),

LICENSE

The MIT License

Author

Kohki Makimoto kohki.makimoto@gmail.com

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-08-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固