Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Nov 22, 2023
1 parent d8ad977 commit 2740f30
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Fields/BelongsTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo as EloquentRelation;
use Illuminate\Http\Request;
use Illuminate\Routing\Router;

class BelongsTo extends Relation
{
Expand All @@ -29,4 +30,28 @@ public function resolveHydrate(Request $request, Model $model, mixed $value): vo

parent::resolveHydrate($request, $model, $value);
}

/**
* {@inheritdoc}
*/
public function asSubResource(bool $value = true): static
{
return $this;
}

/**
* {@inheritdoc}
*/
public function isSubResource(): bool
{
return false;
}

/**
* {@inheritdoc}
*/
public function routes(Router $router): void
{
//
}
}

2 comments on commit 2740f30

@szepeviktor
Copy link
Collaborator

@szepeviktor szepeviktor commented on 2740f30 Nov 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamgergo Add this shell script as .git/hooks/pre-commit to catch/fix coding standards violations.

#!/bin/bash

git diff --cached --name-only --diff-filter=AMTX HEAD | xargs -- php vendor/bin/pint

Then chmod +x .git/hooks/pre-commit

@szepeviktor
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe git diff needs -- '*.php' ...

Please sign in to comment.