mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 00:34:29 -04:00
Static analysis cleanup
This commit is contained in:
parent
a9027c1c33
commit
caa7c30620
@ -11,36 +11,36 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Client;
|
||||
use App\Models\Design;
|
||||
use App\Utils\Statics;
|
||||
use App\Models\Account;
|
||||
use App\Models\TaxRate;
|
||||
use App\Models\Webhook;
|
||||
use App\Models\Scheduler;
|
||||
use App\Models\TaskStatus;
|
||||
use App\Models\PaymentTerm;
|
||||
use Illuminate\Support\Str;
|
||||
use League\Fractal\Manager;
|
||||
use App\Models\GroupSetting;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Models\CompanyGateway;
|
||||
use App\Utils\Traits\AppSetup;
|
||||
use App\Models\BankIntegration;
|
||||
use App\Models\BankTransaction;
|
||||
use App\Models\ExpenseCategory;
|
||||
use League\Fractal\Resource\Item;
|
||||
use App\Models\BankTransactionRule;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\Client;
|
||||
use App\Models\CompanyGateway;
|
||||
use App\Models\Design;
|
||||
use App\Models\ExpenseCategory;
|
||||
use App\Models\GroupSetting;
|
||||
use App\Models\PaymentTerm;
|
||||
use App\Models\Scheduler;
|
||||
use App\Models\TaskStatus;
|
||||
use App\Models\TaxRate;
|
||||
use App\Models\User;
|
||||
use App\Models\Webhook;
|
||||
use App\Transformers\ArraySerializer;
|
||||
use App\Transformers\EntityTransformer;
|
||||
use League\Fractal\Resource\Collection;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use League\Fractal\Serializer\JsonApiSerializer;
|
||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Statics;
|
||||
use App\Utils\Traits\AppSetup;
|
||||
use Illuminate\Contracts\Container\BindingResolutionException;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Str;
|
||||
use League\Fractal\Manager;
|
||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
use League\Fractal\Resource\Collection;
|
||||
use League\Fractal\Resource\Item;
|
||||
use League\Fractal\Serializer\JsonApiSerializer;
|
||||
|
||||
/**
|
||||
* Class BaseController.
|
||||
@ -298,6 +298,7 @@ class BaseController extends Controller
|
||||
*/
|
||||
protected function refreshResponse($query)
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = auth()->user();
|
||||
|
||||
$this->manager->parseIncludes($this->first_load);
|
||||
@ -536,7 +537,9 @@ class BaseController extends Controller
|
||||
|
||||
$paginator = $query->paginate($limit);
|
||||
|
||||
$query = $paginator->getCollection();
|
||||
/** @phpstan-ignore-next-line */
|
||||
$query = $paginator->getCollection(); /** @phpstan-ignore-line */
|
||||
|
||||
|
||||
$resource = new Collection($query, $transformer, $this->entity_type);
|
||||
|
||||
@ -572,6 +575,7 @@ class BaseController extends Controller
|
||||
*/
|
||||
protected function miniLoadResponse($query)
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = auth()->user();
|
||||
|
||||
$this->serializer = request()->input('serializer') ?: EntityTransformer::API_SERIALIZER_ARRAY;
|
||||
@ -638,6 +642,8 @@ class BaseController extends Controller
|
||||
$limit = $this->resolveQueryLimit();
|
||||
|
||||
$paginator = $query->paginate($limit);
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
$query = $paginator->getCollection();
|
||||
$resource = new Collection($query, $transformer, $this->entity_type);
|
||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||
@ -675,6 +681,7 @@ class BaseController extends Controller
|
||||
*/
|
||||
protected function timeConstrainedResponse($query)
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = auth()->user();
|
||||
|
||||
if ($user->getCompany()->is_large) {
|
||||
@ -902,13 +909,18 @@ class BaseController extends Controller
|
||||
$limit = $this->resolveQueryLimit();
|
||||
|
||||
$paginator = $query->paginate($limit);
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
$query = $paginator->getCollection();
|
||||
|
||||
$resource = new Collection($query, $transformer, $this->entity_type);
|
||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||
} else {
|
||||
$resource = new Collection($query, $transformer, $this->entity_type);
|
||||
}
|
||||
|
||||
// else {
|
||||
// $resource = new Collection($query, $transformer, $this->entity_type);
|
||||
// }
|
||||
|
||||
return $this->response($this->manager->createData($resource)->toArray());
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property int|null $created_at
|
||||
* @property int|null $updated_at
|
||||
* @property int|null $deleted_at
|
||||
* @property int $is_deleted
|
||||
* @property int $is_system
|
||||
* @property bool $is_deleted
|
||||
* @property bool $is_system
|
||||
* @property-read \App\Models\Account $account
|
||||
* @property-read \App\Models\Company $company
|
||||
* @property-read \App\Models\CompanyUser|null $company_user
|
||||
|
@ -25,12 +25,12 @@ trait Excludable
|
||||
|
||||
/**
|
||||
* Exclude an array of elements from the result.
|
||||
* @param $query
|
||||
* @param $columns
|
||||
* @param Builder $query
|
||||
* @param array $columns
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function scopeExclude($query, $columns)
|
||||
public function scopeExclude($query, $columns): \Illuminate\Database\Eloquent\Builder
|
||||
{
|
||||
return $query->select(array_diff($this->getTableColumns(), (array) $columns));
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ use Laracasts\Presenter\PresentableTrait;
|
||||
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
|
||||
* @method bool hasPermissionTo(string $permission)
|
||||
* @method \Illuminate\Database\Eloquent\Builder|Company getCompany()
|
||||
* @method \App\Models\Company getCompany()
|
||||
* @method bool hasExcludedPermissions(array $matched_permission, array $excluded_permissions)
|
||||
* @method bool isAdmin()
|
||||
* @method bool isSuperUser()
|
||||
|
Loading…
x
Reference in New Issue
Block a user