private function datepickers()
{
$dates = '';
foreach ($this->fields as $field) {
if ($field->type == 'date') {
$camel = ucfirst(Str::camel(str_replace('_', ' ', $field->title)));
$dates .= '/**
* Set attribute to date format
* @param $input
*/
public function set' . $camel . 'Attribute($input)
{
if($input != \'\') {
$this->attributes[\'' . $field->title . '\'] = Carbon::createFromFormat(config(\'quickadmin.date_format\'), $input)->format(\'Y-m-d\');
}else{
$this->attributes[\'' . $field->title . '\'] = \'\';
}
}
/**
* Get attribute from date format
* @param $input
*
* @return string
*/
public function get' . $camel . 'Attribute($input)
{
if($input != \'0000-00-00\') {
return Carbon::createFromFormat(\'Y-m-d\', $input)->format(config(\'quickadmin.date_format\'));
}else{
return \'\';
}
}' . "\r\n\r\n";
}
}
return $dates;
}