Skip to content

Commit

Permalink
pint
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickweh committed Jul 26, 2024
1 parent 25c7777 commit b95ec04
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
return new class() extends Migration
{
public function up(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
return new class() extends Migration
{
/**
* Run the migrations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
return new class() extends Migration
{
/**
* Run the migrations.
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __invoke(Request $request, $model)
/** @var Builder $query */
if ($request->has('selected')) {

Check failure on line 25 in src/Controllers/SearchController.php

View workflow job for this annotation

GitHub Actions / phpstan

Variable $query in PHPDoc tag @var does not exist.
$selected = $request->get('selected');
$optionValue = $request->get('option-value') ?: (new $model)->getKeyName();
$optionValue = $request->get('option-value') ?: app($model)->getKeyName();

$query = $model::query();
is_array($selected)
Expand Down
2 changes: 1 addition & 1 deletion src/DataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public function getFormatters(): array
foreach ($this->getIncludedRelations() as $loadedRelation) {
$relationFormatters = method_exists($loadedRelation['model'], 'typeScriptAttributes')
? $loadedRelation['model']::typeScriptAttributes()
: (new $loadedRelation['model'])->getCasts();
: app($loadedRelation['model'])->getCasts();

foreach ($loadedRelation['loaded_columns'] as $loadedColumn) {
$formatters[$loadedColumn['loaded_as']] = $relationFormatters[$loadedColumn['column']] ?? null;
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers/ModelInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static function forModel(string|Model|ReflectionClass $model): BaseModelI
}

if (is_string($model)) {
$model = new $model;
$model = app($model);
}

try {
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers/RelationFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class RelationFinder extends BaseRelationFinder
public static function forModel(string|Model $model): Collection
{
if (is_string($model)) {
$model = new $model;
$model = app($model);
}

return (new static())->relations($model);
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/DataTables/SupportsRelations.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ protected function constructWith(): array

protected function getModelRelations($modelInfo): array
{
$modelQuery = new $modelInfo->class;
$modelQuery = app($modelInfo->class);
$modelRelations = [];
foreach ($modelInfo->relations as $relation) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
return new class() extends Migration
{
/**
* Run the migrations.
Expand Down

0 comments on commit b95ec04

Please sign in to comment.