-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #483 from OpenSynergic/submission-review-improvement
feat: submission review improvement
- Loading branch information
Showing
33 changed files
with
1,536 additions
and
1,183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace App\Actions\Review; | ||
|
||
use App\Models\Review; | ||
use App\Models\Submission; | ||
use Illuminate\Support\Facades\DB; | ||
use Lorisleiva\Actions\Concerns\AsAction; | ||
|
||
class ReviewCreateAction | ||
{ | ||
use AsAction; | ||
|
||
public function handle(array $data): Review | ||
{ | ||
try { | ||
DB::beginTransaction(); | ||
|
||
$record = Review::create($data); | ||
|
||
if (array_key_exists('meta', $data) && is_array($data['meta'])) { | ||
$record->setManyMeta($data['meta']); | ||
} | ||
|
||
DB::commit(); | ||
} catch (\Throwable $th) { | ||
DB::rollBack(); | ||
|
||
throw $th; | ||
} | ||
|
||
return $record; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace App\Actions\Review; | ||
|
||
use App\Models\Review; | ||
use App\Models\Submission; | ||
use Illuminate\Support\Facades\DB; | ||
use Lorisleiva\Actions\Concerns\AsAction; | ||
|
||
class ReviewUpdateAction | ||
{ | ||
use AsAction; | ||
|
||
public function handle(Review $record, array $data): Review | ||
{ | ||
try { | ||
DB::beginTransaction(); | ||
|
||
$record->update($data); | ||
|
||
if (array_key_exists('meta', $data) && is_array($data['meta'])) { | ||
$record->setManyMeta($data['meta']); | ||
} | ||
|
||
DB::commit(); | ||
} catch (\Throwable $th) { | ||
DB::rollBack(); | ||
|
||
throw $th; | ||
} | ||
|
||
return $record; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\Forms; | ||
|
||
use Closure; | ||
use App\Facades\Hook; | ||
use Illuminate\Support\Str; | ||
use Filament\Forms\Components\Concerns\HasId; | ||
|
||
class Form extends \Filament\Forms\Form | ||
{ | ||
use HasId; | ||
|
||
/** | ||
* @param array<Component> | Closure $components | ||
*/ | ||
public function components(array | Closure $components): static | ||
{ | ||
if($this->getId()){ | ||
Hook::call('Forms::Form::components::' . Str::camel($this->getId()), [&$components, $this]); | ||
} | ||
|
||
return parent::components($components); | ||
} | ||
|
||
public function toHtml(): string | ||
{ | ||
return $this->render()->render(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace App\Infolists; | ||
|
||
use App\Facades\Hook; | ||
use Closure; | ||
use Illuminate\Support\Str; | ||
use Filament\Infolists\Components\Concerns\HasId; | ||
|
||
class Infolist extends \Filament\Infolists\Infolist | ||
{ | ||
use HasId; | ||
|
||
/** | ||
* @param array<Component> | Closure $components | ||
*/ | ||
public function components(array | Closure $components): static | ||
{ | ||
if($this->getId()){ | ||
Hook::call('Forms::Form::components::' . Str::camel($this->getId()), [&$components, $this]); | ||
} | ||
|
||
return parent::components($components); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.