laravel-liberu /
genealogy
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Tables\Builders; |
||
| 4 | |||
| 5 | use App\Models\DnaMatching; |
||
| 6 | use Illuminate\Database\Eloquent\Builder; |
||
| 7 | use LaravelEnso\Tables\Contracts\Table; |
||
| 8 | |||
| 9 | class DnaMatchingTable implements Table |
||
| 10 | { |
||
| 11 | protected const TemplatePath = __DIR__.'/../Templates/dnamatching.json'; |
||
| 12 | |||
| 13 | public function query(): Builder |
||
| 14 | { |
||
| 15 | $role = \Auth::user()->role_id; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 16 | $userId = \Auth::user()->id; |
||
|
0 ignored issues
–
show
|
|||
| 17 | |||
| 18 | if (in_array($role, [1, 2])) { |
||
| 19 | return DnaMatching::selectRaw(' |
||
|
0 ignored issues
–
show
The expression
return App\Models\DnaMat...gs.largest_cm_segment') could return the type Illuminate\Database\Eloq...gHasThroughRelationship which is incompatible with the type-hinted return Illuminate\Database\Eloquent\Builder. Consider adding an additional type-check to rule them out.
Loading history...
|
|||
| 20 | dna_matchings.id, dna_matchings.file1, dna_matchings.file2, dna_matchings.image, dna_matchings.created_at, dna_matchings.match_id, dna_matchings.total_shared_cm, dna_matchings.match_name, dna_matchings.largest_cm_segment'); |
||
| 21 | } |
||
| 22 | |||
| 23 | return DnaMatching::selectRaw(' dna_matchings.id, dna_matchings.file1, |
||
| 24 | dna_matchings.file2, dna_matchings.image, dna_matchings.created_at, dna_matchings.largest_cm_segment, dna_matchings.match_name, dna_matchings.total_shared_cm, dna_matchings.match_id')->where('dna_matchings.user_id', $userId)->orderBy('total_shared_cm', 'desc'); |
||
| 25 | } |
||
| 26 | |||
| 27 | public function templatePath(): string |
||
| 28 | { |
||
| 29 | return static::TemplatePath; |
||
| 30 | } |
||
| 31 | } |
||
| 32 |