Skip to content

Commit

Permalink
Result comments (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjustesen authored Feb 18, 2023
1 parent 84759a2 commit 1238840
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/Filament/Resources/ResultResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,21 @@ public static function table(Table $table): Table
->hidden(fn (Result $record): bool => ! $record->is_successful)
->openUrlInNewTab(),
Tables\Actions\ViewAction::make(),
Tables\Actions\Action::make('updateComments')
->icon('heroicon-o-annotation')
->mountUsing(fn (Forms\ComponentContainer $form, Result $record) => $form->fill([
'comments' => $record->comments,
]))
->action(function (Result $record, array $data): void {
$record->comments = $data['comments'];
$record->save();
})
->form([
Forms\Components\Textarea::make('comments')
->rows(6)
->maxLength(500),
])
->modalButton('Save'),
Tables\Actions\DeleteAction::make(),
]),
])
Expand Down
1 change: 1 addition & 0 deletions app/Models/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Result extends Model
'server_host',
'server_name',
'url',
'comments',
'scheduled',
'successful',
'data',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('results', function (Blueprint $table) {
$table->text('comments')->nullable()->after('url');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
};

0 comments on commit 1238840

Please sign in to comment.