Set fields to pireps in prefile/update calls

This commit is contained in:
Nabeel Shahzad
2018-02-06 13:46:23 -06:00
parent 8b2eddc72d
commit de0c71cb06
5 changed files with 60 additions and 19 deletions

View File

@@ -2,11 +2,8 @@
namespace App\Models;
use Log;
/**
* Class PirepField
*
* @package App\Models
*/
class PirepField extends BaseModel
@@ -49,4 +46,14 @@ class PirepField extends BaseModel
$model->slug = str_slug($model->name);
});
}
/**
* When setting the name attribute, also set the slug
* @param $name
*/
public function setNameAttribute($name)
{
$this->attributes['name'] = $name;
$this->attributes['slug'] = str_slug($name);
}
}