Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/views/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class="form-control @error('command') is-invalid @enderror">
type="text"
placeholder="{{ trans('schedule::schedule.messages.custom-command-here')}}"
name="command_custom"
value="{{ old('command_custom', $schedule->command_custom ?? '') }}"
class="form-control @error('command_custom') is-invalid @enderror"/>
@error('command_custom')
<div class="invalid-feedback">{{ $message }}</div>
Expand Down
10 changes: 10 additions & 0 deletions src/DatabaseSchedulingServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use RobersonFaria\DatabaseSchedule\Console\Commands\TestJobCommand;
use RobersonFaria\DatabaseSchedule\Console\Commands\ScheduleClearCacheCommand;
use RobersonFaria\DatabaseSchedule\Console\Scheduling\Schedule;
use RobersonFaria\DatabaseSchedule\Models\Schedule as ScheduleModel;

class DatabaseSchedulingServiceProvider extends DatabaseScheduleApplicationServiceProvider
{
Expand Down Expand Up @@ -72,6 +73,15 @@ public function boot()
PhpUnitTestJobCommand::class,
ScheduleClearCacheCommand::class,
]);

Route::bind(
'schedule',
function ($value) {
return ScheduleModel::withTrashed()
->where('id', $value)
->firstOrFail();
}
);
}

protected function registerRoutes()
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Controllers/ScheduleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function store(ScheduleRequest $request)
{
try {
$schedule = app(config('database-schedule.model'));
$schedule->create($request->all());
$schedule->create($request->validated());

return redirect()
->action('\RobersonFaria\DatabaseSchedule\Http\Controllers\ScheduleController@index')
Expand Down Expand Up @@ -142,7 +142,7 @@ public function edit(Schedule $schedule)
public function update(ScheduleRequest $request, Schedule $schedule)
{
try {
$schedule->update($request->all());
$schedule->update($request->validated());

return redirect()
->action('\RobersonFaria\DatabaseSchedule\Http\Controllers\ScheduleController@index')
Expand Down
10 changes: 10 additions & 0 deletions src/Http/Requests/ScheduleRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ public function rules()
'log_filename' => 'nullable|alpha_dash',
'groups' => 'nullable|regex:/^[A-Za-z-_0-9,]*$/',
'environments' => 'nullable|regex:/^[A-Za-z-_0-9,]*$/',
'params' => 'present|array',
'options' => 'present|array',
'sendmail_success' => 'present|boolean',
'sendmail_error' => 'present|boolean',
'log_success' => 'present|boolean',
'log_error' => 'present|boolean',
'even_in_maintenance_mode' => 'present|boolean',
'without_overlapping' => 'present|boolean',
'on_one_server' => 'present|boolean',
'run_in_background' => 'present|boolean'
];
}

Expand Down