Migrate backend to Porto architecture and fix minor bugs

- Fully transitioned the backend to the Porto architectural pattern
- Improved code organization and maintainability
- Fixed minor bugs and inconsistencies
This commit is contained in:
F4ilji
2025-05-12 08:47:43 +05:00
parent 76deaf75f3
commit c01016a154
620 changed files with 16218 additions and 6073 deletions
@@ -0,0 +1,108 @@
<?php
namespace App\Containers\Widget\Policies;
use App\Containers\User\Models\User;
use App\Containers\Widget\Models\ContactWidget;
use Illuminate\Auth\Access\HandlesAuthorization;
class ContactWidgetPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->can('view_any_contact::widget');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, ContactWidget $contactWidget): bool
{
return $user->can('view_contact::widget');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->can('create_contact::widget');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, ContactWidget $contactWidget): bool
{
return $user->can('update_contact::widget');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, ContactWidget $contactWidget): bool
{
return $user->can('delete_contact::widget');
}
/**
* Determine whether the user can bulk delete.
*/
public function deleteAny(User $user): bool
{
return $user->can('delete_any_contact::widget');
}
/**
* Determine whether the user can permanently delete.
*/
public function forceDelete(User $user, ContactWidget $contactWidget): bool
{
return $user->can('force_delete_contact::widget');
}
/**
* Determine whether the user can permanently bulk delete.
*/
public function forceDeleteAny(User $user): bool
{
return $user->can('force_delete_any_contact::widget');
}
/**
* Determine whether the user can restore.
*/
public function restore(User $user, ContactWidget $contactWidget): bool
{
return $user->can('restore_contact::widget');
}
/**
* Determine whether the user can bulk restore.
*/
public function restoreAny(User $user): bool
{
return $user->can('restore_any_contact::widget');
}
/**
* Determine whether the user can replicate.
*/
public function replicate(User $user, ContactWidget $contactWidget): bool
{
return $user->can('replicate_contact::widget');
}
/**
* Determine whether the user can reorder.
*/
public function reorder(User $user): bool
{
return $user->can('reorder_contact::widget');
}
}
@@ -0,0 +1,108 @@
<?php
namespace App\Containers\Widget\Policies;
use App\Containers\User\Models\User;
use App\Containers\Widget\Models\CustomForm;
use Illuminate\Auth\Access\HandlesAuthorization;
class CustomFormPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->can('view_any_custom::form');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, CustomForm $customForm): bool
{
return $user->can('view_custom::form');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->can('create_custom::form');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, CustomForm $customForm): bool
{
return $user->can('update_custom::form');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, CustomForm $customForm): bool
{
return $user->can('delete_custom::form');
}
/**
* Determine whether the user can bulk delete.
*/
public function deleteAny(User $user): bool
{
return $user->can('delete_any_custom::form');
}
/**
* Determine whether the user can permanently delete.
*/
public function forceDelete(User $user, CustomForm $customForm): bool
{
return $user->can('force_delete_custom::form');
}
/**
* Determine whether the user can permanently bulk delete.
*/
public function forceDeleteAny(User $user): bool
{
return $user->can('force_delete_any_custom::form');
}
/**
* Determine whether the user can restore.
*/
public function restore(User $user, CustomForm $customForm): bool
{
return $user->can('restore_custom::form');
}
/**
* Determine whether the user can bulk restore.
*/
public function restoreAny(User $user): bool
{
return $user->can('restore_any_custom::form');
}
/**
* Determine whether the user can replicate.
*/
public function replicate(User $user, CustomForm $customForm): bool
{
return $user->can('replicate_custom::form');
}
/**
* Determine whether the user can reorder.
*/
public function reorder(User $user): bool
{
return $user->can('reorder_custom::form');
}
}
@@ -0,0 +1,108 @@
<?php
namespace App\Containers\Widget\Policies;
use App\Containers\User\Models\User;
use App\Containers\Widget\Models\CustomFormResponse;
use Illuminate\Auth\Access\HandlesAuthorization;
class CustomFormResponsePolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->can('view_any_custom::form::response');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, CustomFormResponse $customFormResponse): bool
{
return $user->can('view_custom::form::response');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->can('create_custom::form::response');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, CustomFormResponse $customFormResponse): bool
{
return $user->can('update_custom::form::response');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, CustomFormResponse $customFormResponse): bool
{
return $user->can('delete_custom::form::response');
}
/**
* Determine whether the user can bulk delete.
*/
public function deleteAny(User $user): bool
{
return $user->can('delete_any_custom::form::response');
}
/**
* Determine whether the user can permanently delete.
*/
public function forceDelete(User $user, CustomFormResponse $customFormResponse): bool
{
return $user->can('force_delete_custom::form::response');
}
/**
* Determine whether the user can permanently bulk delete.
*/
public function forceDeleteAny(User $user): bool
{
return $user->can('force_delete_any_custom::form::response');
}
/**
* Determine whether the user can restore.
*/
public function restore(User $user, CustomFormResponse $customFormResponse): bool
{
return $user->can('restore_custom::form::response');
}
/**
* Determine whether the user can bulk restore.
*/
public function restoreAny(User $user): bool
{
return $user->can('restore_any_custom::form::response');
}
/**
* Determine whether the user can replicate.
*/
public function replicate(User $user, CustomFormResponse $customFormResponse): bool
{
return $user->can('replicate_custom::form::response');
}
/**
* Determine whether the user can reorder.
*/
public function reorder(User $user): bool
{
return $user->can('reorder_custom::form::response');
}
}
@@ -0,0 +1,108 @@
<?php
namespace App\Containers\Widget\Policies;
use App\Containers\User\Models\User;
use App\Containers\Widget\Models\PageReferenceList;
use Illuminate\Auth\Access\HandlesAuthorization;
class PageReferenceListPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->can('view_any_page::reference::list');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, PageReferenceList $pageReferenceList): bool
{
return $user->can('view_page::reference::list');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->can('create_page::reference::list');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, PageReferenceList $pageReferenceList): bool
{
return $user->can('update_page::reference::list');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, PageReferenceList $pageReferenceList): bool
{
return $user->can('delete_page::reference::list');
}
/**
* Determine whether the user can bulk delete.
*/
public function deleteAny(User $user): bool
{
return $user->can('delete_any_page::reference::list');
}
/**
* Determine whether the user can permanently delete.
*/
public function forceDelete(User $user, PageReferenceList $pageReferenceList): bool
{
return $user->can('force_delete_page::reference::list');
}
/**
* Determine whether the user can permanently bulk delete.
*/
public function forceDeleteAny(User $user): bool
{
return $user->can('force_delete_any_page::reference::list');
}
/**
* Determine whether the user can restore.
*/
public function restore(User $user, PageReferenceList $pageReferenceList): bool
{
return $user->can('restore_page::reference::list');
}
/**
* Determine whether the user can bulk restore.
*/
public function restoreAny(User $user): bool
{
return $user->can('restore_any_page::reference::list');
}
/**
* Determine whether the user can replicate.
*/
public function replicate(User $user, PageReferenceList $pageReferenceList): bool
{
return $user->can('replicate_page::reference::list');
}
/**
* Determine whether the user can reorder.
*/
public function reorder(User $user): bool
{
return $user->can('reorder_page::reference::list');
}
}
@@ -0,0 +1,108 @@
<?php
namespace App\Containers\Widget\Policies;
use App\Containers\User\Models\User;
use App\Containers\Widget\Models\Slide;
use Illuminate\Auth\Access\HandlesAuthorization;
class SlidePolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->can('view_any_slide');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Slide $slide): bool
{
return $user->can('view_slide');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->can('create_slide');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Slide $slide): bool
{
return $user->can('update_slide');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Slide $slide): bool
{
return $user->can('delete_slide');
}
/**
* Determine whether the user can bulk delete.
*/
public function deleteAny(User $user): bool
{
return $user->can('delete_any_slide');
}
/**
* Determine whether the user can permanently delete.
*/
public function forceDelete(User $user, Slide $slide): bool
{
return $user->can('force_delete_slide');
}
/**
* Determine whether the user can permanently bulk delete.
*/
public function forceDeleteAny(User $user): bool
{
return $user->can('force_delete_any_slide');
}
/**
* Determine whether the user can restore.
*/
public function restore(User $user, Slide $slide): bool
{
return $user->can('restore_slide');
}
/**
* Determine whether the user can bulk restore.
*/
public function restoreAny(User $user): bool
{
return $user->can('restore_any_slide');
}
/**
* Determine whether the user can replicate.
*/
public function replicate(User $user, Slide $slide): bool
{
return $user->can('replicate_slide');
}
/**
* Determine whether the user can reorder.
*/
public function reorder(User $user): bool
{
return $user->can('reorder_slide');
}
}
@@ -0,0 +1,108 @@
<?php
namespace App\Containers\Widget\Policies;
use App\Containers\User\Models\User;
use App\Containers\Widget\Models\Slider;
use Illuminate\Auth\Access\HandlesAuthorization;
class SliderPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->can('view_any_slider');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Slider $slider): bool
{
return $user->can('view_slider');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->can('create_slider');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Slider $slider): bool
{
return $user->can('update_slider');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Slider $slider): bool
{
return $user->can('delete_slider');
}
/**
* Determine whether the user can bulk delete.
*/
public function deleteAny(User $user): bool
{
return $user->can('delete_any_slider');
}
/**
* Determine whether the user can permanently delete.
*/
public function forceDelete(User $user, Slider $slider): bool
{
return $user->can('force_delete_slider');
}
/**
* Determine whether the user can permanently bulk delete.
*/
public function forceDeleteAny(User $user): bool
{
return $user->can('force_delete_any_slider');
}
/**
* Determine whether the user can restore.
*/
public function restore(User $user, Slider $slider): bool
{
return $user->can('restore_slider');
}
/**
* Determine whether the user can bulk restore.
*/
public function restoreAny(User $user): bool
{
return $user->can('restore_any_slider');
}
/**
* Determine whether the user can replicate.
*/
public function replicate(User $user, Slider $slider): bool
{
return $user->can('replicate_slider');
}
/**
* Determine whether the user can reorder.
*/
public function reorder(User $user): bool
{
return $user->can('reorder_slider');
}
}