mercredi 19 octobre 2016

Save all values in Uppercase Laravel 5+

What would be the best way to save all values in the database as uppercase. So before saving convert all strings to uppercase. I see options to use Events or a trait would probably be best but not quite sure how to achieve this. I do not want to create accessors & mutators for each of my fields.

Got this from : http://ift.tt/2eFAbG2

trait Trackable {
public static function bootTrackable()
{
    static::creating(function ($model) {
        // blah blah
    });

    static::updating(function ($model) {
        // bleh bleh
    });

    static::deleting(function ($model) {
        // bluh bluh
    });
}
}

Im not sure how I would be able to get the actual request values to convert them to uppercase?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire