- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
$data = [];
$firstGenreId = Genre::where('homepage_filter_band', 1)->first()->id;
$bandSearch = [
'limit' => request('limit') ?? 6,
'genre' => $firstGenreId,
'category' => BandCategory::where('homepage_filter', 1)->first()->id,
'status' => 1
];
$subGenres = Genre::getGenresByCategory($bandSearch['genre']);
$bandSearch['genre'] = [$bandSearch['genre']];
foreach ($subGenres as $subGenre){
array_push($bandSearch['genre'], $subGenre->id);
}
$data['bandsGenre']['bands'] = Band::getBandsLimitListByGenre($bandSearch);
$data['bandsGenre']['filters'] = Genre::isExistGenreByBandFilter();
$data['bandsGenre']['active_filter'] = $firstGenreId;
$data['bandsGenre']['type'] = 'genre';
$data['bandsCategories']['bands'] = Band::getBandsLimitListByCategory($bandSearch);
$data['bandsCategories']['filters'] = BandCategory::isExistCategoryByBandFilter();
$data['bandsCategories']['active_filter'] = $bandSearch['category'];
$data['bandsCategories']['type'] = 'category';
$data['bandsStatus']['bands'] = Band::getBandsLimitListByStatus($bandSearch);
$data['bandsStatus']['active_filter'] = 1;
$data['bandsStatus']['filters'] = (object)[
0 => [
'id' => 1,
'name' => trans('validation-custom.newest')
],
1 => [
'id' => 2,
'name' => trans('validation-custom.lastUpdated')
]
];
$data['bandsStatus']['type'] = 'status';
$firstGenreId = Genre::where('homepage_filter_musician', 1)->first()->id;
$firstInstrumentId = Instrument::where('homepage_filter', 1)->first()->id;
$musicianSearch = [
'limit' => request('limit') ?? 6,
'genre' => $firstGenreId,
'instrument' => $firstInstrumentId,
'status' => 1
];
$subGenres = Genre::getGenresByCategory($musicianSearch['genre']);
$musicianSearch['genre'] = [$musicianSearch['genre']];
foreach ($subGenres as $subGenre){
array_push($musicianSearch['genre'], $subGenre->id);
}
$subInstruments = Instrument::getInstrumentsByCategory($musicianSearch['instrument']);
$musicianSearch['instrument'] = [$musicianSearch['instrument']];
foreach ($subInstruments as $subInstrument){
array_push($musicianSearch['instrument'], $subInstrument->id);
}
$data['musiciansGenre']['musicians'] = User::getMusiciansLimitListByGenre($musicianSearch);
$data['musiciansGenre']['filters'] = Genre::isExistGenreByFilter();
$data['musiciansGenre']['active_filter'] = $firstGenreId;
$data['musiciansGenre']['type'] = 'genre';
$data['musiciansInstrument']['musicians'] = User::getMusiciansLimitListByInstrument($musicianSearch);
$data['musiciansInstrument']['filters'] = Instrument::isExistInstrumentByFilter();
$data['musiciansInstrument']['active_filter'] = $firstInstrumentId;
$data['musiciansInstrument']['type'] = 'instrument';
$data['musiciansStatus']['musicians'] = User::getMusiciansLimitListByStatus($musicianSearch);
$data['musiciansStatus']['active_filter'] = 1;
$data['musiciansStatus']['filters'] = (object)[
0 => [
'id' => 1,
'name' => trans('validation-custom.newest')
],
1 => [
'id' => 2,
'name' => trans('validation-custom.lastUpdated')
]
];
$data['musiciansStatus']['type'] = 'status';
return response()->json($data, 200);
gost 07.08.2020 13:21 # 0
Ох уж эти говнопрослойки-недоORM…
6a6yuH 07.08.2020 13:43 # 0
gost 07.08.2020 13:51 # 0
6a6yuH 07.08.2020 13:53 # +2
class Tovar extends Db
6a6yuH 07.08.2020 13:27 # 0
6a6yuH 07.08.2020 16:52 # 0
Stallman 07.08.2020 17:43 # 0
Какой мудрый класс. Изначально подразумевается, что в SQL коде будет инъекция.
OCETuHCKuu_nemyx 08.08.2020 09:45 # +1