1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-16 16:13:20 +01:00
invoiceninja/app/Http/Controllers/Shop/ProfileController.php

41 lines
1.1 KiB
PHP
Raw Normal View History

2020-08-05 04:12:38 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
2020-08-05 04:12:38 +02:00
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2023-01-28 23:21:40 +01:00
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
2020-08-05 04:12:38 +02:00
*
2021-06-16 08:58:16 +02:00
* @license https://www.elastic.co/licensing/elastic-license
2020-08-05 04:12:38 +02:00
*/
namespace App\Http\Controllers\Shop;
use App\Http\Controllers\BaseController;
use App\Models\Company;
use App\Transformers\Shop\CompanyShopProfileTransformer;
use App\Utils\Traits\MakesHash;
use Illuminate\Http\Request;
2020-10-28 11:10:49 +01:00
use stdClass;
2020-08-05 04:12:38 +02:00
class ProfileController extends BaseController
{
use MakesHash;
2020-08-05 04:12:38 +02:00
protected $entity_type = Company::class;
protected $entity_transformer = CompanyShopProfileTransformer::class;
2020-08-05 04:21:26 +02:00
public function show(Request $request)
2020-08-05 04:12:38 +02:00
{
2023-10-26 04:57:44 +02:00
/** @var \App\Models\Company $company */
2020-08-05 04:12:38 +02:00
$company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->first();
if (! $company->enable_shop_api) {
2020-10-28 11:10:49 +01:00
return response()->json(['message' => 'Shop is disabled', 'errors' => new stdClass], 403);
}
2020-08-05 04:12:38 +02:00
return $this->itemResponse($company);
}
}