36 lines
695 B
PHP
Executable File
36 lines
695 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Controllers\Api\Seller;
|
|
|
|
use App\Enums\SellerLevel;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Model\Seller\Seller;
|
|
use App\Utils\ThrowException;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class BaseController extends Controller
|
|
{
|
|
|
|
/**
|
|
* @return null|Seller
|
|
*/
|
|
public function seller()
|
|
{
|
|
return Auth::guard('seller')->user();
|
|
}
|
|
|
|
public function sellerId()
|
|
{
|
|
return $this->seller()->id;
|
|
}
|
|
|
|
public function shopId() {
|
|
return $this->seller()->shop_id;
|
|
}
|
|
|
|
public function checkMasterNext()
|
|
{
|
|
ThrowException::isTrue($this->seller()->level != SellerLevel::MASTER, '权限不足!');
|
|
}
|
|
}
|