generated from boboko/starter
Initial commit
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Modules\Core\Customer\Models\Customer as CoreCustomer;
|
||||
|
||||
class Customer extends CoreCustomer
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Modules\Core\Auth\Models\Staff as CoreStaff;
|
||||
|
||||
class Staff extends CoreStaff
|
||||
{
|
||||
public function getMorphClass(): string
|
||||
{
|
||||
return 'staff';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Database\Factories\UserFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Lunar\Base\LunarUser as LunarUserInterface;
|
||||
use Lunar\Base\Traits\LunarUser;
|
||||
use Modules\Core\Auth\Events\UserCreated;
|
||||
|
||||
class User extends Authenticatable implements LunarUserInterface
|
||||
{
|
||||
use LunarUser;
|
||||
|
||||
/** @use HasFactory<UserFactory> */
|
||||
use HasFactory, Notifiable;
|
||||
|
||||
protected $dispatchesEvents = [
|
||||
'created' => UserCreated::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\Customer;
|
||||
use App\Models\Staff;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Lunar\Facades\ModelManifest;
|
||||
use Lunar\Facades\Telemetry;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function boot(): void
|
||||
{
|
||||
Telemetry::optOut();
|
||||
|
||||
if ($this->app->environment('production')) {
|
||||
URL::forceScheme('https');
|
||||
}
|
||||
|
||||
$this->app->booted(function () {
|
||||
ModelManifest::replace(
|
||||
\Lunar\Models\Contracts\Customer::class,
|
||||
Customer::class,
|
||||
);
|
||||
|
||||
$this->app['config']->set(
|
||||
'auth.providers.staff.model',
|
||||
Staff::class,
|
||||
);
|
||||
|
||||
Relation::morphMap([
|
||||
'staff' => \Lunar\Admin\Models\Staff::class,
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Lunar\Admin\Support\Facades\LunarPanel;
|
||||
use Modules\Core\Auth\Filament\Pages\Login;
|
||||
use Modules\Core\CorePlugin;
|
||||
|
||||
class PanelServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
if (! $this->isAdminRequest()) {
|
||||
return;
|
||||
}
|
||||
|
||||
LunarPanel::panel(function (\Filament\Panel $panel) {
|
||||
return $panel
|
||||
->login(Login::class)
|
||||
->plugin(new CorePlugin());
|
||||
});
|
||||
|
||||
LunarPanel::disableTwoFactorAuth();
|
||||
LunarPanel::register();
|
||||
}
|
||||
|
||||
private function isAdminRequest(): bool
|
||||
{
|
||||
if ($this->app->runningInConsole()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$path = request()->path();
|
||||
|
||||
return str_starts_with($path, 'boboko')
|
||||
|| str_starts_with($path, 'livewire');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user