Skip to content

Commit

Permalink
Merge pull request #358 from yungifez/dev
Browse files Browse the repository at this point in the history
Upgrade to Livewire 3
  • Loading branch information
yungifez authored Oct 9, 2023
2 parents ed50706 + b00473a commit 0e45351
Show file tree
Hide file tree
Showing 182 changed files with 1,781 additions and 1,009 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
# Skuul school management system

<p align="center">
<!-- <a href="https://packagist.org/packages/yungifez/skuul">
<img src="https://poser.pugx.org/yungifez/skuul/d/total.svg" alt="Total Composer Downloads">
</a> -->
<a href="https://packagist.org/packages/yungifez/skuul">
<img src="https://poser.pugx.org/yungifez/skuul/v/stable.svg" alt="Latest Stable Version">
</a>
<a href="https://packagist.org/packages/yungifez/skuul">
<img src="https://poser.pugx.org/yungifez/skuul/license.svg" alt="License">
</a>
</p>

>In search of good school management systems written in laravel, I tried so many although most were quite remarkably good they lacked some essential features that I would have loved in a school management system.This made me passionate in building my own school management system. Although it has been difficult, it's actually forming up into a quite useable project.
![schooldash-dahboard-page](https://user-images.githubusercontent.com/63137056/216740379-18cb9f1d-5e80-4bc8-8b99-07d08ea98da4.png)


# CONGRATS V2 OF SKUUL IS OUT


Skuul is awesome, but it had a few shortcomings when it came to some areas like UI speed and application slugishness as it grows. Version 2 fixes these issues and also improves on accessibility.

V2 is way faster and doesn't slow down condiderably as the app grows. Also upgrading should be relatively easy. Requirements remain the same with one exception, we now require node for asset bundling. No worries if you don't have node, there is a solution to that
Expand Down
68 changes: 42 additions & 26 deletions app/Console/Commands/CreateSuperAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;

use function Laravel\Prompts\password;
use function Laravel\Prompts\text;

class CreateSuperAdmin extends Command
{
use PasswordValidationRules;
Expand All @@ -34,46 +37,59 @@ class CreateSuperAdmin extends Command
public function handle()
{
try {
$this->newLine();
$this->alert('Creating super admin');
$this->info('Fill in the following details. You can modify rest of profile at a later stage. Values can not be null');
$this->info('Fill in the following details. You can modify the profile later with other information.');
do {
// code...

//don't allow null values hence do while
$firstName = null;
do {
$firstName = $this->ask('First Name');
} while (is_null($firstName));
$lastName = null;
do {
$lastName = $this->ask('Last Name');
} while (is_null($lastName));
$email = null;
do {
$email = $this->ask('Email');
} while (is_null($email));
do {
$password = $this->secret('Password');
} while (is_null($password));
do {
$passwordConfirmation = $this->secret('Confirm Password');
} while (is_null($passwordConfirmation));
$firstName = text('First name?', required: true, validate: fn (string $value) => match (true) {
strlen($value) < 3 => 'The name must be at least 3 characters.',
strlen($value) > 255 => 'The name must not exceed 255 characters.',
default => null
});
$lastName = text('Last name?', required: true, validate: fn (string $value) => match (true) {
strlen($value) < 3 => 'The name must be at least 3 characters.',
strlen($value) > 255 => 'The name must not exceed 255 characters.',
default => null
});
$email = text('Email?', required: true, validate: fn (string $value) => match (true) {
strlen($value) < 3 => 'The email must be at least 3 characters.',
strlen($value) > 511 => 'The email must not exceed 255 characters.',
filter_var($value, FILTER_VALIDATE_EMAIL) === false => 'The email must be a valid email address.',
default => null
});
$password = password(
'What is your password?',
required:true,
placeholder: 'Minimum 8 characters...',
validate: fn (string $value) => match (true) {
strlen($value) < 8 => 'The password must be at least 8 characters.',
default => null
}
);
$passwordConfirmation = password(
'Confirm your password?',
required:true,
placeholder: 'Input the same password...',
validate: fn (string $value) => match (true) {
$value !== $password => 'The password confirmation does not match.',
default => null
}
);

//validate the input
$validator = Validator::make([
'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'],
'first_name' => ['required', 'string', 'max:255'],
'last_name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:511', 'unique:users'],
'password' => $this->passwordRules(),
]);

//display validation error
foreach ($validator->errors()->all() as $error) {
$this->error($error);
}
Expand All @@ -85,7 +101,7 @@ public function handle()
'email' => $email,
'password' => Hash::make($password),
'address' => 'super admin street',
'birthday' => '22/04/04',
'birthday' => '1/1/1970',
'nationality' => 'nigeria',
'state' => 'lagos',
'city' => 'lagos',
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class InitCommand extends Command
*
* @var string
*/
protected $description = 'Easily install Skuul';
protected $description = 'Install Skuul';

/**
* No of attempts to be made to connect to the
Expand Down
13 changes: 0 additions & 13 deletions app/Http/Livewire/CreateAdminForm.php

This file was deleted.

13 changes: 0 additions & 13 deletions app/Http/Livewire/CreateNoticeForm.php

This file was deleted.

13 changes: 0 additions & 13 deletions app/Http/Livewire/CreateParentForm.php

This file was deleted.

13 changes: 0 additions & 13 deletions app/Http/Livewire/CreateSchoolForm.php

This file was deleted.

13 changes: 0 additions & 13 deletions app/Http/Livewire/CreateSemesterForm.php

This file was deleted.

13 changes: 0 additions & 13 deletions app/Http/Livewire/ListAdminsTable.php

This file was deleted.

13 changes: 0 additions & 13 deletions app/Http/Livewire/ListClassesTable.php

This file was deleted.

13 changes: 0 additions & 13 deletions app/Http/Livewire/ListExamsTable.php

This file was deleted.

13 changes: 0 additions & 13 deletions app/Http/Livewire/ListFeesTable.php

This file was deleted.

13 changes: 0 additions & 13 deletions app/Http/Livewire/ListNoticesTable.php

This file was deleted.

13 changes: 0 additions & 13 deletions app/Http/Livewire/ListParentsTable.php

This file was deleted.

13 changes: 0 additions & 13 deletions app/Http/Livewire/ListSchoolsTable.php

This file was deleted.

30 changes: 30 additions & 0 deletions app/Http/Middleware/CreateCurrentAcademicYearRecord.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;

class CreateCurrentAcademicYearRecord
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
if (auth()?->user()?->studentRecord != null && !auth()->user()?->studentRecord?->academicYears()->find(auth()->user()->school->academic_year_id)) {
auth()->user()->studentRecord->academicYears()->syncWithoutDetaching([
auth()->user()->school->academicYear->id => [
'my_class_id' => auth()->user()->studentRecord->my_class_id,
'section_id' => auth()->user()->studentRecord->section_id,
],
]);
}

return $next($request);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Http\Livewire;
namespace App\Livewire;

use App\Models\MyClass;
use App\Models\Section;
Expand Down Expand Up @@ -33,6 +33,8 @@ class AcademicYearResultTabulation extends Component

public function mount(MyClassService $myClassService)
{
$this->setErrorBag(session()->get('errors', new \Illuminate\Support\MessageBag())->getMessages());

//get semester and use it to fetch all exams in semester
$this->academicYear = auth()->user()->school->academicYear;
$this->classes = $myClassService->getAllClasses();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Http\Livewire;
namespace App\Livewire;

use App\Models\User;
use Livewire\Component;
Expand All @@ -11,6 +11,8 @@ class ApplicationHistory extends Component

public function mount()
{
$this->setErrorBag(session()->get('errors', new \Illuminate\Support\MessageBag())->getMessages());

$this->applicant->loadMissing('accountApplication', 'accountApplication.statuses');
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Http\Livewire;
namespace App\Livewire;

use App\Models\User;
use App\Services\MyClass\MyClassService;
Expand All @@ -27,6 +27,8 @@ class AssignStudentsToParent extends Component

public function mount(SectionService $sectionService, MyClassService $myClassService)
{
$this->setErrorBag(session()->get('errors', new \Illuminate\Support\MessageBag())->getMessages());

$this->classes = $myClassService->getAllClasses();
if ($this->classes->isEmpty()) {
return;
Expand Down
Loading

0 comments on commit 0e45351

Please sign in to comment.