37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use A7kz\Platform\Models\UniModel;
|
|
use A7kz\Platform\Modules\Platform\Segment\Facades\Segment;
|
|
use Exception;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Log;
|
|
use Illuminate\Support\Facades\Notification;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Mpdf\Tag\Mark;
|
|
|
|
class MobileApiController extends Controller
|
|
{
|
|
public function getMarks() {
|
|
$data = [];
|
|
$marks = UniModel::model('pipi_brand_models')->get();
|
|
if (!isset($marks)) {
|
|
return response()->json();
|
|
}
|
|
foreach ($marks as $mark) {
|
|
$brand = UniModel::model('pipi_auto_brands')->find($mark->brand_id);
|
|
$tariffs = UniModel::model('pipi_auto_tariffs')->where('model_id', $mark->id)->first();
|
|
if ($mark->name != 'Ввод остатков') {
|
|
$data[$mark->name] = [
|
|
'brand' => $brand->name,
|
|
'mark' => $mark->name,
|
|
'tariffs' => $tariffs?->toArray()
|
|
];
|
|
}
|
|
}
|
|
return response()->json($data);
|
|
}
|
|
}
|