This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

KurtJensen
KurtJensen

Refer to : https://laravel.com/docs/5.1/eloquent-mutators#accessors-and-mutators

When I use an accessor in a settings model it only works in the settings controller, not in a component or backend controller.

Example:

// In Settings model
public function getShiftStartTimeAttribute($value)
{
    return substr($value, 0, 5);
}
// This works in Settings controller to trim value for timepicker down to HH:MM

But in another controller or component, when I do:

$begining_at = Settings::get('shift_start_time');
// This DOES NOT work to trim value for timepicker down to HH:MM ( I get HH:MM:SS)
tony8938
tony8938

I have the same issue. Does anyone know how to add an accessor to the settings model?

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.