Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result comments #414

Merged
merged 3 commits into from
Feb 18, 2023
Merged
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
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()
{
//
}
};