Allow listing a user by both ID and email. Useful for checking if a user exists by its email.
This commit is contained in:
parent
0472706807
commit
b5d3417167
1 changed files with 5 additions and 1 deletions
|
@ -75,7 +75,11 @@ class UserController extends BaseController
|
|||
*/
|
||||
public function view(Request $request, $id)
|
||||
{
|
||||
$query = Models\User::where('id', $id);
|
||||
if(is_numeric($id)) {
|
||||
$query = Models\User::where('id', $id);
|
||||
} else {
|
||||
$query = Models\User::where('email', $id);
|
||||
}
|
||||
|
||||
if (! is_null($request->input('fields'))) {
|
||||
foreach (explode(',', $request->input('fields')) as $field) {
|
||||
|
|
Loading…
Reference in a new issue