Input flash toggle
lavaeagle opened this issue · comments
I added a toggle for input flashing but idk if my method is a tad ugly.
At the top I put
abstract class Aware extends Eloquent
{
/**
* Flashes Input
*
* @var string $flash_input
*/
public static $flash_input = true;
// if the model is valid, unset old errors
if($valid)
{
$this->errors->messages = array();
}
else // otherwise set the new ones
{
if( self::$flash_input )
Input::flash();
$this->errors = $validator->errors;
}
If you'd like me to make a push to the master I will but idk if you have a better way of doing this or not.
I don't think models should be interacting with Input or session data. I would put something like this in your controller.
if (!$model->save()) {
Input::flash()
}
That's a better idea actually. From glancing at Aware I'd hate for
anything to go in there unnecessarily.
On Fri, Aug 31, 2012 at 8:35 AM, Colby Rabideau notifications@github.comwrote:
I don't think models should be interacting with Input or session data. I
would put something like this in your controller.if (!$model->save) {
Input::flash()
}—
Reply to this email directly or view it on GitHubhttps://github.com/crabideau5691/aware/issues/10#issuecomment-8195815.