Skip to content

Commit 1238840

Browse files
authored
Result comments (alexjustesen#414)
1 parent 84759a2 commit 1238840

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

app/Filament/Resources/ResultResource.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,21 @@ public static function table(Table $table): Table
166166
->hidden(fn (Result $record): bool => ! $record->is_successful)
167167
->openUrlInNewTab(),
168168
Tables\Actions\ViewAction::make(),
169+
Tables\Actions\Action::make('updateComments')
170+
->icon('heroicon-o-annotation')
171+
->mountUsing(fn (Forms\ComponentContainer $form, Result $record) => $form->fill([
172+
'comments' => $record->comments,
173+
]))
174+
->action(function (Result $record, array $data): void {
175+
$record->comments = $data['comments'];
176+
$record->save();
177+
})
178+
->form([
179+
Forms\Components\Textarea::make('comments')
180+
->rows(6)
181+
->maxLength(500),
182+
])
183+
->modalButton('Save'),
169184
Tables\Actions\DeleteAction::make(),
170185
]),
171186
])

app/Models/Result.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Result extends Model
3030
'server_host',
3131
'server_name',
3232
'url',
33+
'comments',
3334
'scheduled',
3435
'successful',
3536
'data',
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('results', function (Blueprint $table) {
17+
$table->text('comments')->nullable()->after('url');
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*
24+
* @return void
25+
*/
26+
public function down()
27+
{
28+
//
29+
}
30+
};

0 commit comments

Comments
 (0)