Fix schedules.completed_at not being null. Closes #2509
This commit is contained in:
@@ -92,7 +92,7 @@ class CreateScheduleCommandHandler
|
||||
];
|
||||
|
||||
$availableParams = array_filter($params, function ($val) {
|
||||
return $val !== null;
|
||||
return $val !== null && $val !== '';
|
||||
});
|
||||
|
||||
return $availableParams;
|
||||
|
||||
@@ -19,6 +19,11 @@ use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use McCool\LaravelAutoPresenter\HasPresenter;
|
||||
|
||||
/**
|
||||
* This is the schedule class.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class Schedule extends Model implements HasPresenter
|
||||
{
|
||||
use SearchableTrait, SortableTrait, ValidatingTrait;
|
||||
@@ -44,6 +49,16 @@ class Schedule extends Model implements HasPresenter
|
||||
*/
|
||||
const COMPLETE = 2;
|
||||
|
||||
/**
|
||||
* The model's attributes.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $attributes = [
|
||||
'status' => self::UPCOMING,
|
||||
'completed_at' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
|
||||
@@ -210,7 +210,7 @@ class SchedulePresenter extends BasePresenter implements Arrayable
|
||||
*/
|
||||
public function completed_at_datetimepicker()
|
||||
{
|
||||
if ($this->wrappedObject->completed_at !== '0000-00-00 00:00:00') {
|
||||
if ($this->wrappedObject->completed_at) {
|
||||
return $this->dates->make($this->wrappedObject->completed_at)->format('Y-m-d H:i');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user