close #4
This commit is contained in:
parent
4ba7734055
commit
80be5c8fd2
@ -27,11 +27,18 @@ class Users extends ApiController
|
|||||||
/**
|
/**
|
||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*
|
*
|
||||||
* @param User $user
|
* @param int|string $id
|
||||||
* @return \Dingo\Api\Http\Response
|
* @return \Dingo\Api\Http\Response
|
||||||
*/
|
*/
|
||||||
public function show(User $user)
|
public function show($id)
|
||||||
{
|
{
|
||||||
|
// Check if we're querying by id or email
|
||||||
|
if (is_numeric($id)) {
|
||||||
|
$user = User::with(['roles', 'permissions'])->findOrFail($id);
|
||||||
|
} else {
|
||||||
|
$user = User::with(['roles', 'permissions'])->where('email', $id)->first();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->response->item($user, new Transformer());
|
return $this->response->item($user, new Transformer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,11 +27,18 @@ class Vendors extends ApiController
|
|||||||
/**
|
/**
|
||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*
|
*
|
||||||
* @param Vendor $vendor
|
* @param int|string $id
|
||||||
* @return \Dingo\Api\Http\Response
|
* @return \Dingo\Api\Http\Response
|
||||||
*/
|
*/
|
||||||
public function show(Vendor $vendor)
|
public function show($id)
|
||||||
{
|
{
|
||||||
|
// Check if we're querying by id or email
|
||||||
|
if (is_numeric($id)) {
|
||||||
|
$vendor = Vendor::findOrFail($id);
|
||||||
|
} else {
|
||||||
|
$vendor = Vendor::where('email', $id)->first();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->response->item($vendor, new Transformer());
|
return $this->response->item($vendor, new Transformer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,11 +27,18 @@ class Customers extends ApiController
|
|||||||
/**
|
/**
|
||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*
|
*
|
||||||
* @param Customer $customer
|
* @param int|string $id
|
||||||
* @return \Dingo\Api\Http\Response
|
* @return \Dingo\Api\Http\Response
|
||||||
*/
|
*/
|
||||||
public function show(Customer $customer)
|
public function show($id)
|
||||||
{
|
{
|
||||||
|
// Check if we're querying by id or email
|
||||||
|
if (is_numeric($id)) {
|
||||||
|
$customer = Customer::findOrFail($id);
|
||||||
|
} else {
|
||||||
|
$customer = Customer::where('email', $id)->first();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->response->item($customer, new Transformer());
|
return $this->response->item($customer, new Transformer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user