input('matrix_username') ?? ''; $city_uuid = $request->input('uuid') ?? ''; $user = null; $cart = null; $city = null; if($city_uuid != ''){ $city = City::where('uuid', $city_uuid)->first(); } if($matrix_username) { $user = User::firstOrCreate([ 'matrix_username' => $matrix_username ]); $cart = Cart::firstOrCreate([ 'user_id' => $user->id, 'status' => 'CART' ]); $city = $cart->getCity(); $city_uuid = $city->uuid; } // Update list of companies $fetcher = new ApiFetcher(); $companyAPI = new CompanyAPI($fetcher); $companyMap = $companyAPI->getMap($city_uuid); $companyAPI->saveMap($companyMap); return new CompanyCollection(Company::all()); } /** * Show the form for creating a new resource. */ public function create() { // } /** * Store a newly created resource in storage. */ public function store(StoreCompanyRequest $request) { // } /** * Display the specified resource. */ public function show(Company $company) { return new CompanyResource($company); } /** * Show the form for editing the specified resource. */ public function edit(Company $company) { // } /** * Update the specified resource in storage. */ public function update(UpdateCompanyRequest $request, Company $company) { // } /** * Remove the specified resource from storage. */ public function destroy(Company $company) { // } }