mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-02 19:51:03 +05:30
26 lines
485 B
PHP
26 lines
485 B
PHP
|
<?php
|
||
|
|
||
|
namespace RelationalExample\Model;
|
||
|
|
||
|
use Illuminate\Database\Capsule\Manager as Capsule;
|
||
|
|
||
|
class Users
|
||
|
{
|
||
|
public function get($username = null)
|
||
|
{
|
||
|
$query = Capsule::table('users')->select(['username', 'name', 'email', 'photo']);
|
||
|
|
||
|
if ($username !== null) {
|
||
|
$query->where('username', '=', $username);
|
||
|
}
|
||
|
|
||
|
$result = $query->get();
|
||
|
|
||
|
if (count($result) > 0) {
|
||
|
return $result;
|
||
|
}
|
||
|
|
||
|
return null;
|
||
|
}
|
||
|
}
|