some stan
This commit is contained in:
@@ -51,7 +51,7 @@ function logDB(): void
|
||||
*/
|
||||
function user(): User
|
||||
{
|
||||
abort_unless(Auth::check(), 'not-authenticated');
|
||||
abort_unless(Auth::check(), 401, 'Unauthorized');
|
||||
|
||||
/** @var \App\Models\User */
|
||||
$user = Auth::user();
|
||||
|
||||
@@ -29,7 +29,10 @@ class EnsureProfileIsFilled
|
||||
$profilePageClass = EditProfilePage::class; // <-- !! IMPORTANT: Change to your page
|
||||
$profilePageUrl = $profilePageClass::getUrl();
|
||||
|
||||
$panelId = filament()->getCurrentPanel()->getId();
|
||||
/** @var \Filament\Panel */
|
||||
$panel = filament()->getCurrentPanel();
|
||||
|
||||
$panelId = $panel->getId();
|
||||
$logoutRouteName = "filament.{$panelId}.auth.logout";
|
||||
|
||||
// 4. Check for 'safe' conditions
|
||||
|
||||
@@ -23,13 +23,14 @@ class UserPassportFields extends Component implements HasForms
|
||||
use HasSort;
|
||||
use InteractsWithForms;
|
||||
|
||||
/** @var array<string, mixed> */
|
||||
public ?array $data = [];
|
||||
|
||||
protected static int $sort = 10;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->form->fill();
|
||||
$this->form->fill(); // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
@@ -160,7 +161,7 @@ class UserPassportFields extends Component implements HasForms
|
||||
{
|
||||
try {
|
||||
/** @var array{first_name: string, last_name: string, patronic_name: null|string, born_at: string, phone: string, email: string, passport_serie: string, passport_id: string, passport_given_at: string, born_place: string, passport_given_by: string, passport_address: string, real_address: string} */
|
||||
$data = $this->form->getState();
|
||||
$data = $this->form->getState(); // @phpstan-ignore-line
|
||||
|
||||
user()->update([
|
||||
'first_name' => $data['first_name'],
|
||||
|
||||
64
app/Modules/Card/CardModule.php
Normal file
64
app/Modules/Card/CardModule.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Card;
|
||||
|
||||
use App\Modules\Makeable;
|
||||
use App\Modules\ModuleContract;
|
||||
|
||||
class CardModule implements ModuleContract
|
||||
{
|
||||
use Makeable;
|
||||
|
||||
/**
|
||||
* Module is enabled
|
||||
*/
|
||||
protected bool $enabled = true;
|
||||
|
||||
/**
|
||||
* Check if is module enabled
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable module
|
||||
*/
|
||||
public function disable(): void
|
||||
{
|
||||
$this->enabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable module
|
||||
*/
|
||||
public function enable(): void
|
||||
{
|
||||
$this->enabled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if module has a filament resource
|
||||
*/
|
||||
public function hasFilamentResource(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module composer requirements
|
||||
*/
|
||||
public function getComposerRequirements(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module composer suggestions
|
||||
*/
|
||||
public function getComposerSuggestions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
49
app/Modules/Card/Controllers/CardController.php
Normal file
49
app/Modules/Card/Controllers/CardController.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Card\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CardController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cards', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained('users')->onDelete('cascade');
|
||||
|
||||
$table->string('number')->index();
|
||||
$table->string('name')->index();
|
||||
$table->string('month');
|
||||
$table->string('year');
|
||||
|
||||
$table->string('type')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cards');
|
||||
}
|
||||
};
|
||||
36
app/Modules/Card/Models/Card.php
Normal file
36
app/Modules/Card/Models/Card.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Card\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property string $number
|
||||
* @property string $name
|
||||
* @property string $month
|
||||
* @property string $year
|
||||
* @property string|null $type
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
*/
|
||||
class Card extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected $table = 'cards';
|
||||
|
||||
/**
|
||||
* Get the user that owns the card.
|
||||
*
|
||||
* @return BelongsTo<User, $this>
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
5
app/Modules/Card/Repositories/CardRepository.php
Normal file
5
app/Modules/Card/Repositories/CardRepository.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Card\Repositories;
|
||||
|
||||
class CardRepository {}
|
||||
@@ -5,7 +5,6 @@ namespace App\Modules\Loan\Models;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Facades\Date;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -13,8 +12,8 @@ use Illuminate\Support\Facades\Date;
|
||||
* @property int $passport_serie
|
||||
* @property int $passport_id
|
||||
* @property int $account_number
|
||||
* @property Date|null $created_at
|
||||
* @property Date|null $updated_at
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
*/
|
||||
class Loan extends Model
|
||||
{
|
||||
@@ -24,7 +23,7 @@ class Loan extends Model
|
||||
/**
|
||||
* User
|
||||
*
|
||||
* @return BelongsTo<User::class>
|
||||
* @return BelongsTo<User, $this>
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace App\Modules\UserAdjustments\Traits;
|
||||
* @property string $locale [default: tk]
|
||||
* @property bool $password_must_be_changed [default: false]
|
||||
* @property bool $must_fill_profile [default: false]
|
||||
* @property null|array $options
|
||||
* @property null|array<string, mixed> $options
|
||||
*/
|
||||
trait UserAdjustments
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user