Issues (364)

app/Tables/Builders/PersonTableIndi.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace App\Tables\Builders;
4
5
use App\Models\Person;
6
use Auth;
7
use Illuminate\Database\Eloquent\Builder;
8
9
class PersonTableIndi extends \LaravelEnso\People\Tables\Builders\PersonTable
0 ignored issues
show
The type LaravelEnso\People\Tables\Builders\PersonTable was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
{
11
    protected const TemplatePath = __DIR__.'/../Templates/peopleindi.json';
12
13
    public function query(): Builder
14
    {
15
        return Person::selectRaw('
16
            people.id, people.title, people.givn, people.surn,  people.appellative, people.email, people.phone,
17
            people.birthday, CASE WHEN users.id is null THEN 0 ELSE 1 END as "user",
18
            companies.name as company, people.created_at
19
        ')->leftJoin('users', 'people.id', '=', 'users.person_id')
20
            ->leftJoin(
21
                'company_person',
22
                fn ($join) => $join
23
                    ->on('people.id', '=', 'company_person.person_id')
24
                    ->where('company_person.is_main', true)
25
            )->leftJoin('companies', 'company_person.company_id', 'companies.id')
26
            ->where('people.id', Auth::user()->person_id);
0 ignored issues
show
Accessing person_id on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
27
    }
28
}
29