init
This commit is contained in:
232 files changed
+25416
No files matched your search
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Tenancy;
|
||||
|
||||
use App\Models\MobileApp;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Pages\Tenancy\RegisterTenant;
|
||||
use Filament\Schemas\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class RegisterMobileApp extends RegisterTenant
|
||||
{
|
||||
public static function getLabel(): string
|
||||
{
|
||||
return 'Add Android app';
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
TextInput::make('name')->required()->maxLength(255),
|
||||
TextInput::make('package_name')->required()->regex('/^[A-Za-z][A-Za-z0-9_]*(\.[A-Za-z][A-Za-z0-9_]*)+$/')->unique(MobileApp::class)->maxLength(255),
|
||||
]);
|
||||
}
|
||||
|
||||
protected function handleRegistration(array $data): MobileApp
|
||||
{
|
||||
$mobileApp = MobileApp::create([
|
||||
...$data,
|
||||
'client_key' => Str::random(48),
|
||||
'management_key' => Str::random(64),
|
||||
'store_url' => 'https://cafebazaar.ir/app/'.$data['package_name'],
|
||||
]);
|
||||
|
||||
$mobileApp->users()->attach(auth()->user(), ['role' => 'owner']);
|
||||
|
||||
return $mobileApp;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user