PHP code example of kohkimakimoto / laravel-message-binder

1. Go to this page and download the library: Download kohkimakimoto/laravel-message-binder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kohkimakimoto / laravel-message-binder example snippets


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!');
});

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

 echo $messages->first('default');