src/: Formatting, doc block hints and cleanup

main
Igor Scheller 5 years ago
parent 2cce967eb0
commit 8b5b9e2c65

@ -43,6 +43,7 @@ class Stats
->distinct(); ->distinct();
$query->where(function ($query) use ($working) { $query->where(function ($query) use ($working) {
/** @var QueryBuilder $query */
if ($working) { if ($working) {
$query $query
->whereNotNull('ShiftEntry.SID') ->whereNotNull('ShiftEntry.SID')
@ -271,7 +272,7 @@ class Stats
{ {
$start = microtime(true); $start = microtime(true);
EventConfig::findOrNew('last_metrics'); (new EventConfig())->findOrNew('last_metrics');
return microtime(true) - $start; return microtime(true) - $start;
} }
@ -281,7 +282,7 @@ class Stats
*/ */
public function databaseWrite() public function databaseWrite()
{ {
$config = EventConfig::findOrNew('last_metrics'); $config = (new EventConfig())->findOrNew('last_metrics');
$config $config
->setAttribute('name', 'last_metrics') ->setAttribute('name', 'last_metrics')
->setAttribute('value', new Carbon()); ->setAttribute('value', new Carbon());

@ -74,7 +74,7 @@ class PasswordResetController extends BaseController
/** @var User $user */ /** @var User $user */
$user = User::whereEmail($data['email'])->first(); $user = User::whereEmail($data['email'])->first();
if ($user) { if ($user) {
$reset = PasswordReset::findOrNew($user->id); $reset = (new PasswordReset)->findOrNew($user->id);
$reset->user_id = $user->id; $reset->user_id = $user->id;
$reset->token = md5(random_bytes(64)); $reset->token = md5(random_bytes(64));
$reset->save(); $reset->save();

@ -219,6 +219,8 @@ class LegacyMiddleware implements MiddlewareInterface
} }
redirect(page_link_to('login')); redirect(page_link_to('login'));
return [];
} }
/** /**

@ -3,17 +3,18 @@
namespace Engelsystem\Models; namespace Engelsystem\Models;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Database\Query\Builder as QueryBuilder;
/** /**
* @property string $name * @property string $name
* @property string $value * @property string $value
* @property \Carbon\Carbon $created_at * @property Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property Carbon $updated_at
* *
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\EventConfig[] whereName($value) * @method static QueryBuilder|EventConfig[] whereName($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\EventConfig[] whereValue($value) * @method static QueryBuilder|EventConfig[] whereValue($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\EventConfig[] whereCreatedAt($value) * @method static QueryBuilder|EventConfig[] whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\EventConfig[] whereUpdatedAt($value) * @method static QueryBuilder|EventConfig[] whereUpdatedAt($value)
*/ */
class EventConfig extends BaseModel class EventConfig extends BaseModel
{ {

@ -2,19 +2,21 @@
namespace Engelsystem\Models; namespace Engelsystem\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Query\Builder as QueryBuilder;
/** /**
* @property int $id * @property int $id
* @property string $level * @property string $level
* @property string $message * @property string $message
* @property \Carbon\Carbon|null $created_at * @property Carbon|null $created_at
* *
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\LogEntry[] whereId($value) * @method static QueryBuilder|LogEntry[] whereId($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\LogEntry[] whereLevel($value) * @method static QueryBuilder|LogEntry[] whereLevel($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\LogEntry[] whereMessage($value) * @method static QueryBuilder|LogEntry[] whereMessage($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\LogEntry[] whereCreatedAt($value) * @method static QueryBuilder|LogEntry[] whereCreatedAt($value)
*/ */
class LogEntry extends BaseModel class LogEntry extends BaseModel
{ {

@ -2,14 +2,16 @@
namespace Engelsystem\Models\User; namespace Engelsystem\Models\User;
use Illuminate\Database\Query\Builder as QueryBuilder;
/** /**
* @property string|null $dect * @property string|null $dect
* @property string|null $email * @property string|null $email
* @property string|null $mobile * @property string|null $mobile
* *
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Contact[] whereDect($value) * @method static QueryBuilder|Contact[] whereDect($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Contact[] whereEmail($value) * @method static QueryBuilder|Contact[] whereEmail($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Contact[] whereMobile($value) * @method static QueryBuilder|Contact[] whereMobile($value)
*/ */
class Contact extends HasUserModel class Contact extends HasUserModel
{ {

@ -2,12 +2,15 @@
namespace Engelsystem\Models\User; namespace Engelsystem\Models\User;
use Carbon\Carbon;
use Illuminate\Database\Query\Builder as QueryBuilder;
/** /**
* @property string $token * @property string $token
* @property \Carbon\Carbon|null $created_at * @property Carbon|null $created_at
* *
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PasswordReset[] whereToken($value) * @method static QueryBuilder|PasswordReset[] whereToken($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PasswordReset[] whereCreatedAt($value) * @method static QueryBuilder|PasswordReset[] whereCreatedAt($value)
*/ */
class PasswordReset extends HasUserModel class PasswordReset extends HasUserModel
{ {

@ -2,18 +2,21 @@
namespace Engelsystem\Models\User; namespace Engelsystem\Models\User;
use Carbon\Carbon;
use Illuminate\Database\Query\Builder as QueryBuilder;
/** /**
* @property string|null $first_name * @property string|null $first_name
* @property string|null $last_name * @property string|null $last_name
* @property string|null $shirt_size * @property string|null $shirt_size
* @property \Carbon\Carbon|null $planned_arrival_date * @property Carbon|null $planned_arrival_date
* @property \Carbon\Carbon|null $planned_departure_date * @property Carbon|null $planned_departure_date
* *
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData[] whereFirstName($value) * @method static QueryBuilder|PersonalData[] whereFirstName($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData[] whereLastName($value) * @method static QueryBuilder|PersonalData[] whereLastName($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData[] whereShirtSize($value) * @method static QueryBuilder|PersonalData[] whereShirtSize($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData[] wherePlannedArrivalDate($value) * @method static QueryBuilder|PersonalData[] wherePlannedArrivalDate($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData[] wherePlannedDepartureDate($value) * @method static QueryBuilder|PersonalData[] wherePlannedDepartureDate($value)
*/ */
class PersonalData extends HasUserModel class PersonalData extends HasUserModel
{ {

@ -2,16 +2,18 @@
namespace Engelsystem\Models\User; namespace Engelsystem\Models\User;
use Illuminate\Database\Query\Builder as QueryBuilder;
/** /**
* @property string $language * @property string $language
* @property int $theme * @property int $theme
* @property bool $email_human * @property bool $email_human
* @property bool $email_shiftinfo * @property bool $email_shiftinfo
* *
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Settings[] whereLanguage($value) * @method static QueryBuilder|Settings[] whereLanguage($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Settings[] whereTheme($value) * @method static QueryBuilder|Settings[] whereTheme($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Settings[] whereEmailHuman($value) * @method static QueryBuilder|Settings[] whereEmailHuman($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Settings[] whereEmailShiftinfo($value) * @method static QueryBuilder|Settings[] whereEmailShiftinfo($value)
*/ */
class Settings extends HasUserModel class Settings extends HasUserModel
{ {

@ -2,20 +2,23 @@
namespace Engelsystem\Models\User; namespace Engelsystem\Models\User;
use Carbon\Carbon;
use Illuminate\Database\Query\Builder as QueryBuilder;
/** /**
* @property bool $arrived * @property bool $arrived
* @property \Carbon\Carbon|null $arrival_date * @property Carbon|null $arrival_date
* @property bool $active * @property bool $active
* @property bool $force_active * @property bool $force_active
* @property bool $got_shirt * @property bool $got_shirt
* @property int $got_voucher * @property int $got_voucher
* *
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State[] whereArrived($value) * @method static QueryBuilder|State[] whereArrived($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State[] whereArrivalDate($value) * @method static QueryBuilder|State[] whereArrivalDate($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State[] whereActive($value) * @method static QueryBuilder|State[] whereActive($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State[] whereForceActive($value) * @method static QueryBuilder|State[] whereForceActive($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State[] whereGotShirt($value) * @method static QueryBuilder|State[] whereGotShirt($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State[] whereGotVoucher($value) * @method static QueryBuilder|State[] whereGotVoucher($value)
*/ */
class State extends HasUserModel class State extends HasUserModel
{ {

@ -2,8 +2,10 @@
namespace Engelsystem\Models\User; namespace Engelsystem\Models\User;
use Carbon\Carbon;
use Engelsystem\Models\BaseModel; use Engelsystem\Models\BaseModel;
use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Query\Builder as QueryBuilder;
/** /**
* @property integer $id * @property integer $id
@ -11,23 +13,23 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
* @property string $email * @property string $email
* @property string $password * @property string $password
* @property string $api_key * @property string $api_key
* @property \Carbon\Carbon|null $last_login_at * @property Carbon|null $last_login_at
* @property \Carbon\Carbon $created_at * @property Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property Carbon $updated_at
* *
* @property-read \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Contact $contact * @property-read QueryBuilder|Contact $contact
* @property-read \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData $personalData * @property-read QueryBuilder|PersonalData $personalData
* @property-read \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Settings $settings * @property-read QueryBuilder|Settings $settings
* @property-read \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State $state * @property-read QueryBuilder|State $state
* *
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User whereId($value) * @method static QueryBuilder|User whereId($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User[] whereName($value) * @method static QueryBuilder|User[] whereName($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User[] whereEmail($value) * @method static QueryBuilder|User[] whereEmail($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User[] wherePassword($value) * @method static QueryBuilder|User[] wherePassword($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User[] whereApiKey($value) * @method static QueryBuilder|User[] whereApiKey($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User[] whereLastLoginAt($value) * @method static QueryBuilder|User[] whereLastLoginAt($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User[] whereCreatedAt($value) * @method static QueryBuilder|User[] whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User[] whereUpdatedAt($value) * @method static QueryBuilder|User[] whereUpdatedAt($value)
*/ */
class User extends BaseModel class User extends BaseModel
{ {

@ -3,13 +3,14 @@
namespace Engelsystem\Models\User; namespace Engelsystem\Models\User;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Query\Builder as QueryBuilder;
/** /**
* @property integer $user_id * @property integer $user_id
* *
* @property-read \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User $user * @property-read QueryBuilder|User $user
* *
* @method static \Illuminate\Database\Query\Builder|static whereUserId($value) * @method static QueryBuilder|static whereUserId($value)
*/ */
trait UsesUserModel trait UsesUserModel
{ {

@ -52,6 +52,7 @@ function base_path($path = '')
*/ */
function config($key = null, $default = null) function config($key = null, $default = null)
{ {
/** @var Config $config */
$config = app('config'); $config = app('config');
if (empty($key)) { if (empty($key)) {
@ -119,6 +120,7 @@ function response($content = '', $status = 200, $headers = [])
*/ */
function session($key = null, $default = null) function session($key = null, $default = null)
{ {
/** @var SessionInterface $session */
$session = app('session'); $session = app('session');
if (is_null($key)) { if (is_null($key)) {

Loading…
Cancel
Save