witooh/message

There is no license information available for the latest version (dev-master) of this package.

dev-master 2013-07-14 17:57 UTC

This package is not auto-updated.

Last update: 2024-05-06 12:39:14 UTC


README

#Laravel Message#

##Installation##

add in app.config

return array(
    'providers'=>array(
        ...
        ...
        'Witooh\Message\MessageServiceProvider',
    ),

    'alias'=>array(
        '''
        ...
        'Message' => 'Witooh\Message\Facades\Message',
    ),
);

##Usage##

###Message###

Message will generate json message data

public function getIndex(){
    return Response::json(Message::success($data, $header);
}

The response will be like this

{
    header:{
        status: 200,
        message: 'success'
    },
    body:[
        {id: 1, name: 'test1'},
        {id: 2, nmae: 'test2'}
    ]
}

Thow Error Exception to Json Response

public function testExceptioons()
    {
        throw new PermissionException(Message::permission($message));
        throw new AuthenticateException(Message::auth($message));
        throw new NoutFoundException(Message::notfound($message));
        throw new ValidationException(Message::validation($errors));
    }