2020-08-05 04:12:38 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2020-08-05 04:12:38 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Shop;
|
|
|
|
|
|
|
|
use App\Http\Controllers\BaseController;
|
|
|
|
use App\Models\Company;
|
|
|
|
use App\Models\CompanyToken;
|
|
|
|
use App\Models\Product;
|
|
|
|
use App\Transformers\ProductTransformer;
|
|
|
|
use App\Transformers\Shop\CompanyShopProfileTransformer;
|
|
|
|
use App\Utils\Traits\MakesHash;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
class ProfileController extends BaseController
|
|
|
|
{
|
|
|
|
use MakesHash;
|
2020-09-06 11:38:10 +02:00
|
|
|
|
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
|
|
|
{
|
|
|
|
$company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->first();
|
|
|
|
|
2020-09-06 11:38:10 +02:00
|
|
|
if (! $company->enable_shop_api) {
|
|
|
|
return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass], 403);
|
|
|
|
}
|
2020-08-05 04:12:38 +02:00
|
|
|
|
|
|
|
return $this->itemResponse($company);
|
|
|
|
}
|
|
|
|
}
|