first&last
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
try {
|
||||
$companyName = Setting::query()->where('key', 'company_name')->value('value');
|
||||
$timezone = Setting::query()->where('key', 'timezone')->value('value');
|
||||
|
||||
if ($companyName) {
|
||||
config(['app.name' => $companyName]);
|
||||
}
|
||||
|
||||
if ($timezone) {
|
||||
config(['app.timezone' => $timezone]);
|
||||
date_default_timezone_set($timezone);
|
||||
}
|
||||
} catch (\Throwable) {
|
||||
// During initial migration the settings table can be unavailable.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\ActivityLog;
|
||||
use App\Models\Department;
|
||||
use App\Models\Equipment;
|
||||
use App\Models\EquipmentCategory;
|
||||
use App\Models\Priority;
|
||||
use App\Models\RequestType;
|
||||
use App\Models\ServiceRequest;
|
||||
use App\Models\Setting;
|
||||
use App\Models\Status;
|
||||
use App\Models\User;
|
||||
use App\Policies\ActivityLogPolicy;
|
||||
use App\Policies\DepartmentPolicy;
|
||||
use App\Policies\EquipmentCategoryPolicy;
|
||||
use App\Policies\EquipmentPolicy;
|
||||
use App\Policies\PriorityPolicy;
|
||||
use App\Policies\RequestTypePolicy;
|
||||
use App\Policies\ServiceRequestPolicy;
|
||||
use App\Policies\SettingPolicy;
|
||||
use App\Policies\StatusPolicy;
|
||||
use App\Policies\UserPolicy;
|
||||
// use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The model to policy mappings for the application.
|
||||
*
|
||||
* @var array<class-string, class-string>
|
||||
*/
|
||||
protected $policies = [
|
||||
ActivityLog::class => ActivityLogPolicy::class,
|
||||
Department::class => DepartmentPolicy::class,
|
||||
Equipment::class => EquipmentPolicy::class,
|
||||
EquipmentCategory::class => EquipmentCategoryPolicy::class,
|
||||
Priority::class => PriorityPolicy::class,
|
||||
RequestType::class => RequestTypePolicy::class,
|
||||
ServiceRequest::class => ServiceRequestPolicy::class,
|
||||
Setting::class => SettingPolicy::class,
|
||||
Status::class => StatusPolicy::class,
|
||||
User::class => UserPolicy::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Events\RequestAssigned;
|
||||
use App\Events\RequestCreated;
|
||||
use App\Events\RequestStatusChanged;
|
||||
use App\Listeners\LogRequestAssigned;
|
||||
use App\Listeners\LogRequestCreated;
|
||||
use App\Listeners\LogRequestStatusChanged;
|
||||
use App\Listeners\SendAssignedNotification;
|
||||
use App\Listeners\SendStatusChangedNotification;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event to listener mappings for the application.
|
||||
*
|
||||
* @var array<class-string, array<int, class-string>>
|
||||
*/
|
||||
protected $listen = [
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
],
|
||||
RequestAssigned::class => [
|
||||
LogRequestAssigned::class,
|
||||
SendAssignedNotification::class,
|
||||
],
|
||||
RequestCreated::class => [
|
||||
LogRequestCreated::class,
|
||||
],
|
||||
RequestStatusChanged::class => [
|
||||
LogRequestStatusChanged::class,
|
||||
SendStatusChangedNotification::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if events and listeners should be automatically discovered.
|
||||
*/
|
||||
public function shouldDiscoverEvents(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The path to your application's "home" route.
|
||||
*
|
||||
* Typically, users are redirected here after authentication.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/dashboard';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, and other route configuration.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||
});
|
||||
|
||||
$this->routes(function () {
|
||||
Route::middleware('api')
|
||||
->prefix('api')
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->group(base_path('routes/web.php'));
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user