weeble/feedback-messages

This package is abandoned and no longer maintained. The author suggests using the nibbletech/feedback-messages package instead.

Simple flash session messages

v1.0 2015-06-05 17:20 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:32:36 UTC


README

A package to make it really easy to pass and retrieve messages within the session.

Installation

Composer

Add the package to your composer.json file:

"nibbletech/feedback-messages": "dev-master"

Laravel

In laravel add the following to your app.php:

	'providers' => array(
		...
		...

		'Nibbletech\Support\FeedbackServiceProvider'

	),

	'aliases' => array(
		...
		...

		'Feedback' => 'Nibbletech\Support\Facades\Feedback'

	)

Usage

You add messages to the session by passing a message, the message type (e.g 'error') and setting an optional channel (defaults to 'global').

To add a message:

Feedback::add('You found a great package!', 'success', 'custom-channel')

Feedback uses magic methods to make it really easy to add messages of a certain type, just call the type you want as the function and the package handles the rest. These take a message string and an optional 2nd paramater which allows you to set the channel the message goes into, otherwise it defaults to the global channel:

Feedback::info('message', 'optional-channel')
Feedback::error('message')
Feedback::success('message')

Retreiving Messages

All as original structure

To retrieve an array of all messages just call:

Feedback::all();

Specific Channel

You can retrieve an array of all the messages for a specific channel:

Feedback::get('channel-name');

All messages by type

This returns an array of all messages of a specfic type, regardless of their channel

Feedback::byType('error');