Skip to content

Commit

Permalink
PHP Linting (Pint)
Browse files Browse the repository at this point in the history
  • Loading branch information
yungifez authored and github-actions[bot] committed Feb 15, 2023
1 parent d5365be commit abad0da
Show file tree
Hide file tree
Showing 201 changed files with 1,652 additions and 1,691 deletions.
44 changes: 22 additions & 22 deletions app/Actions/Fortify/CreateNewUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,37 @@ class CreateNewUser implements CreatesNewUsers
public function create(array $input)
{
Validator::make($input, [
'name' => ['required', 'string', 'max:511'],
'email' => ['required', 'string', 'email:rfc,dns', 'max:511', 'unique:users'],
'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'],
'name' => ['required', 'string', 'max:511'],
'email' => ['required', 'string', 'email:rfc,dns', 'max:511', 'unique:users'],
'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'],
'password' => $this->passwordRules(),
// 'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['required', 'accepted'] : '',
'school_id' => ['required', 'exists:schools,id'],
'birthday' => ['required', 'date', 'before:today'],
'address' => ['required', 'string', 'max:500'],
'school_id' => ['required', 'exists:schools,id'],
'birthday' => ['required', 'date', 'before:today'],
'address' => ['required', 'string', 'max:500'],
'blood_group' => ['required', 'string', 'max:255'],
'religion' => ['nullable', 'string', 'max:255'],
'religion' => ['nullable', 'string', 'max:255'],
'nationality' => ['required', 'string', 'max:255'],
'state' => ['required', 'string', 'max:255'],
'city' => ['required', 'string', 'max:255'],
'gender' => ['required', 'string', 'max:255'],
'phone' => ['nullable', 'string', 'max:255'],
'state' => ['required', 'string', 'max:255'],
'city' => ['required', 'string', 'max:255'],
'gender' => ['required', 'string', 'max:255'],
'phone' => ['nullable', 'string', 'max:255'],
])->validate();

$user = User::create([
'name' => $input['name'],
'email' => $input['email'],
'birthday' => $input['birthday'],
'password' => Hash::make($input['password']),
'address' => $input['address'],
'school_id' => $input['school_id'],
'name' => $input['name'],
'email' => $input['email'],
'birthday' => $input['birthday'],
'password' => Hash::make($input['password']),
'address' => $input['address'],
'school_id' => $input['school_id'],
'blood_group' => $input['blood_group'],
'religion' => $input['religion'],
'religion' => $input['religion'],
'nationality' => $input['nationality'],
'state' => $input['state'],
'city' => $input['city'],
'gender' => $input['gender'],
'phone' => $input['phone'],
'state' => $input['state'],
'city' => $input['city'],
'gender' => $input['gender'],
'phone' => $input['phone'],
]);

if (isset($input['photo'])) {
Expand Down
3 changes: 1 addition & 2 deletions app/Actions/Fortify/ResetUserPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class ResetUserPassword implements ResetsUserPasswords
/**
* Validate and reset the user's forgotten password.
*
* @param mixed $user
*
* @param mixed $user
* @return void
*/
public function reset($user, array $input)
Expand Down
7 changes: 3 additions & 4 deletions app/Actions/Fortify/UpdateUserPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@ class UpdateUserPassword implements UpdatesUserPasswords
/**
* Validate and update the user's password.
*
* @param mixed $user
*
* @param mixed $user
* @return void
*/
public function update($user, array $input)
{
Validator::make($input, [
'current_password' => ['required', 'string'],
'password' => $this->passwordRules(),
'password' => $this->passwordRules(),
])->after(function ($validator) use ($user, $input) {
if (!isset($input['current_password']) || !Hash::check($input['current_password'], $user->password)) {
if (! isset($input['current_password']) || ! Hash::check($input['current_password'], $user->password)) {
$validator->errors()->add('current_password', __('The provided password does not match your current password.'));
}
})->validateWithBag('updatePassword');
Expand Down
66 changes: 32 additions & 34 deletions app/Actions/Fortify/UpdateUserProfileInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,24 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
/**
* Validate and update the given user's profile information.
*
* @param mixed $user
*
* @param mixed $user
* @return void
*/
public function update($user, array $input)
{
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'email:rfc,dns', 'max:255', Rule::unique('users')->ignore($user->id)],
'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'],
'birthday' => ['required', 'date', 'before:today'],
'address' => ['required', 'string', 'max:500'],
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'email:rfc,dns', 'max:255', Rule::unique('users')->ignore($user->id)],
'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'],
'birthday' => ['required', 'date', 'before:today'],
'address' => ['required', 'string', 'max:500'],
'blood_group' => ['required', 'string', 'max:255'],
'religion' => ['nullable', 'string', 'max:255'],
'religion' => ['nullable', 'string', 'max:255'],
'nationality' => ['required', 'string', 'max:255'],
'state' => ['required', 'string', 'max:255'],
'city' => ['required', 'string', 'max:255'],
'gender' => ['required', 'string', 'max:255'],
'phone' => ['nullable', 'string', 'max:255'],
'state' => ['required', 'string', 'max:255'],
'city' => ['required', 'string', 'max:255'],
'gender' => ['required', 'string', 'max:255'],
'phone' => ['nullable', 'string', 'max:255'],
])->validate();

if (isset($input['photo'])) {
Expand All @@ -42,17 +41,17 @@ public function update($user, array $input)
$this->updateVerifiedUser($user, $input);
} else {
$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
'birthday' => $input['birthday'],
'address' => $input['address'],
'name' => $input['name'],
'email' => $input['email'],
'birthday' => $input['birthday'],
'address' => $input['address'],
'blood_group' => $input['blood_group'],
'religion' => $input['religion'] ?? '',
'religion' => $input['religion'] ?? '',
'nationality' => $input['nationality'],
'state' => $input['state'],
'city' => $input['city'],
'gender' => $input['gender'],
'phone' => $input['phone'] ?? '',
'state' => $input['state'],
'city' => $input['city'],
'gender' => $input['gender'],
'phone' => $input['phone'] ?? '',
])->save();
}

Expand All @@ -62,25 +61,24 @@ public function update($user, array $input)
/**
* Update the given verified user's profile information.
*
* @param mixed $user
*
* @param mixed $user
* @return void
*/
protected function updateVerifiedUser($user, array $input)
{
$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
'name' => $input['name'],
'email' => $input['email'],
'email_verified_at' => null,
'birthday' => $input['birthday'],
'address' => $input['address'],
'blood_group' => $input['blood_group'],
'religion' => $input['religion'] ?? '',
'nationality' => $input['nationality'],
'state' => $input['state'],
'city' => $input['city'],
'gender' => $input['gender'],
'phone' => $input['phone'] ?? '',
'birthday' => $input['birthday'],
'address' => $input['address'],
'blood_group' => $input['blood_group'],
'religion' => $input['religion'] ?? '',
'nationality' => $input['nationality'],
'state' => $input['state'],
'city' => $input['city'],
'gender' => $input['gender'],
'phone' => $input['phone'] ?? '',
])->save();

$user->sendEmailVerificationNotification();
Expand Down
3 changes: 1 addition & 2 deletions app/Actions/Jetstream/DeleteUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class DeleteUser implements DeletesUsers
/**
* Delete the given user.
*
* @param mixed $user
*
* @param mixed $user
* @return void
*/
public function delete($user)
Expand Down
30 changes: 15 additions & 15 deletions app/Console/Commands/CreateSuperAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ public function handle()

//validate the input
$validator = Validator::make([
'first_name' => $firstName,
'last_name' => $lastName,
'email' => $email,
'password' => $password,
'first_name' => $firstName,
'last_name' => $lastName,
'email' => $email,
'password' => $password,
'password_confirmation' => $passwordConfirmation,
], [
'first_name' => ['required', 'string', 'max:511'],
'last_name' => ['required', 'string', 'max:511'],
'email' => ['required', 'string', 'email', 'max:511', 'unique:users'],
'password' => $this->passwordRules(),
'last_name' => ['required', 'string', 'max:511'],
'email' => ['required', 'string', 'email', 'max:511', 'unique:users'],
'password' => $this->passwordRules(),
]);

//display validation error
Expand All @@ -81,16 +81,16 @@ public function handle()

//create super admin
$superAdmin = User::firstOrCreate([
'name' => "$firstName $lastName",
'email' => $email,
'password' => Hash::make($password),
'address' => 'super admin street',
'birthday' => '22/04/04',
'name' => "$firstName $lastName",
'email' => $email,
'password' => Hash::make($password),
'address' => 'super admin street',
'birthday' => '22/04/04',
'nationality' => 'nigeria',
'state' => 'lagos',
'city' => 'lagos',
'state' => 'lagos',
'city' => 'lagos',
'blood_group' => 'A+',
'gender' => 'male',
'gender' => 'male',
]);

//assign role
Expand Down
20 changes: 10 additions & 10 deletions app/Console/Commands/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function generateEnv()
{
$this->newLine();
$this->line('Generating .env file.....');
if (!file_exists(base_path('.env'))) {
if (! file_exists(base_path('.env'))) {
$this->components->task('Copying .env file', static function (): void {
copy(base_path('.env.example'), base_path('.env'));
});
Expand All @@ -104,7 +104,7 @@ public function generateAppKey()
$this->line('Generating app encryption key');

$key = $this->laravel['config']['app.key'];
if (!$key) {
if (! $key) {
$this->call('key:generate');
} else {
$this->info('Encryption key exists already -- skipping');
Expand Down Expand Up @@ -229,15 +229,15 @@ public function setMailCredentials()
$mailReplyName = $this->ask('Mail Reply Name', getenv('MAIL_REPLY_NAME'));

$mailCredentials = [
'MAIL_MAILER' => $mailMailer,
'MAIL_HOST' => $mailHost,
'MAIL_PORT' => $mailPort,
'MAIL_USERNAME' => $mailUsername,
'MAIL_PASSWORD' => $mailPassword,
'MAIL_FROM_ADDRESS' => $mailFromAddress,
'MAIL_FROM_NAME' => $mailFromName,
'MAIL_MAILER' => $mailMailer,
'MAIL_HOST' => $mailHost,
'MAIL_PORT' => $mailPort,
'MAIL_USERNAME' => $mailUsername,
'MAIL_PASSWORD' => $mailPassword,
'MAIL_FROM_ADDRESS' => $mailFromAddress,
'MAIL_FROM_NAME' => $mailFromName,
'MAIL_REPLY_ADDRESS' => $mailReplyAddress,
'MAIL_REPLY_NAME' => $mailReplyName,
'MAIL_REPLY_NAME' => $mailReplyName,
];

$this->setEnvironmentValue($mailCredentials);
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Commands/UpdateApplicationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private function intro()

sleep(2);

if (!$this->confirm('Do you wish to continue?')) {
if (! $this->confirm('Do you wish to continue?')) {
$this->error('Operation cancelled, thank you for using Skuul');
exit();
}
Expand Down Expand Up @@ -111,7 +111,7 @@ public function splitVersionNumber($versionNumber)

public function optimize()
{
if (!$this->confirm('Do you want to optimize this application?')) {
if (! $this->confirm('Do you want to optimize this application?')) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion app/Events/AccountStatusChanged.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AccountStatusChanged
/**
* Create a new event instance.
*
* @param string $reason
* @param string $reason
*/
public function __construct(User $applicant, string $status, ?string $reason = '')
{
Expand Down
3 changes: 1 addition & 2 deletions app/Exceptions/ApplicationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ class ApplicationException extends Exception
/**
* Render the exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function render($request)
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/AccountApplicationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ public function changeStatusView(User $applicant)
/**
* Change Application Statis.
*
* @param Request $request
*
* @param Request $request
* @return void
*/
public function changeStatus(User $applicant, AccountApplicationStatusChangeRequest $request)
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/ExamController.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function setExamActiveStatus(Exam $exam, UpdateExamStatusRequest $request
/**
* Set publish result status.
*
* @param UpdatePublishResultStatusRequest $request
* @param UpdatePublishResultStatusRequest $request
*/
public function setPublishResultStatus(Exam $exam, UpdateExamStatusRequest $request): RedirectResponse
{
Expand Down
12 changes: 6 additions & 6 deletions app/Http/Controllers/GraduationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(StudentService $studentService, UserService $userSer
*/
public function index()
{
if (!auth()->user()->can('view graduations')) {
if (! auth()->user()->can('view graduations')) {
return abort(403, 'Unauthorized action.');
}

Expand All @@ -36,13 +36,13 @@ public function index()
/**
* Graduate view.
*
* @throws \Illuminate\Auth\Access\AuthorizationException
*
* @return \Illuminate\Http\Response
*
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function graduateView()
{
if (!auth()->user()->can('graduate student')) {
if (! auth()->user()->can('graduate student')) {
return abort(403, 'Unauthorized action.');
}

Expand All @@ -57,7 +57,7 @@ public function graduateView()
*/
public function graduate(StudentGraduateRequest $request)
{
if (!auth()->user()->can('graduate student')) {
if (! auth()->user()->can('graduate student')) {
return abort(403, 'Unauthorized action.');
}
$data = collect($request->except('_token'));
Expand All @@ -74,7 +74,7 @@ public function graduate(StudentGraduateRequest $request)
*/
public function resetGraduation(User $student)
{
if (!auth()->user()->can('reset graduation')) {
if (! auth()->user()->can('reset graduation')) {
return abort(403, 'Unauthorized action.');
}
$this->userService->verifyUserIsOfRoleElseNotFound($student, 'student');
Expand Down
Loading

0 comments on commit abad0da

Please sign in to comment.