phpstan 5 errors fixed

This commit is contained in:
2024-11-25 15:34:09 +05:00
parent 2e0cc45e99
commit 0d875acc4e
28 changed files with 463 additions and 248 deletions

View File

@@ -10,6 +10,28 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
/**
* @property int $id
* @property string $unique_id
* @property string $type
* @property string $passport_name
* @property string $passport_surname
* @property string $phone
* @property string $email
* @property string $region
* @property int $branch_id
* @property int $user_id
* @property string $address
* @property array $sender_datas
* @property array $payment_reciever
* @property string $documents
* @property string $status
* @property string $notes
* @property \Illuminate\Support\Carbon $created_at
* @property \Illuminate\Support\Carbon $updated_at
* @property bool $paid
* @property \Illuminate\Support\Carbon $deleted_at
*/
class SberPaymentOrder extends Model implements HasMedia
{
use InteractsWithMedia;

View File

@@ -2,6 +2,7 @@
namespace App\Modules\SberPaymentOrder\Nova\Resources\Concerns;
use App\Modules\SberPaymentOrder\Models\SberPaymentOrder;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Http\Request;
@@ -16,7 +17,9 @@ trait NovaSberPaymentOrderAuth
return;
}
if ($this->resource->user_id == auth()->id()) {
/** @var SberPaymentOrder $resource */
$resource = $this->resource;
if ($resource->user_id == auth()->id()) {
return;
}
@@ -44,7 +47,9 @@ trait NovaSberPaymentOrderAuth
return;
}
if ($this->resource->user_id == auth()->id()) {
/** @var SberPaymentOrder $resource */
$resource = $this->resource;
if ($resource->user_id == auth()->id()) {
return;
}
@@ -78,6 +83,6 @@ trait NovaSberPaymentOrderAuth
/** Force delete */
public function authorizedToForceDelete(Request $request)
{
throw_unless(auth()->user()->isMe(), AuthorizationException::class);
return auth()->user()->isMe();
}
}

View File

@@ -332,7 +332,10 @@ class NovaSberPaymentOrder extends Resource
->icon('credit-card')
->sole()
->canSee(function ($request) {
if (in_array($this->resource->status, [
/** @var \App\Modules\SberPaymentOrder\Models\SberPaymentOrder $resource */
$resource = $this->resource;
if (in_array($resource->status, [
OrderRepo::PENDING,
OrderRepo::CANCELLED,
])) {