add password must be changed to user nova resource
This commit is contained in:
@@ -110,6 +110,14 @@ class VisaMasterPaymentOrder extends Model implements HasMedia
|
||||
$this->addMediaCollection('sender_passport_local_old_replacement')->singleFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* User
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Branch
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,7 @@ use App\Modules\VisaMasterPaymentOrder\Nova\Resources\Concerns\VisaMasterPayment
|
||||
use App\Nova\Actions\MakePaymentNovaVisaMaster;
|
||||
use App\Nova\Filters\VisaMasterMonthlyPaidFilter;
|
||||
use App\Nova\Resource;
|
||||
use App\Nova\User;
|
||||
use App\Repos\Order\Card\CardOrderRepo;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Nova\NovaRepo;
|
||||
@@ -21,8 +22,8 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Nova\Fields\Badge;
|
||||
use Laravel\Nova\Fields\BelongsTo;
|
||||
use Laravel\Nova\Fields\HasMany;
|
||||
use Laravel\Nova\Fields\Hidden;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Select;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
@@ -175,9 +176,10 @@ class NovaVisaMasterPaymentOrder extends Resource
|
||||
ID::make()
|
||||
->hideFromDetail(),
|
||||
|
||||
Hidden::make('user_id')
|
||||
->default(auth()->id())
|
||||
->hideWhenUpdating(),
|
||||
BelongsTo::make(__('User'), 'user', User::class)
|
||||
->searchable()
|
||||
->fullWidth()
|
||||
->showCreateRelationButton(),
|
||||
|
||||
Text::make(__('ID'), 'unique_id')
|
||||
->exceptOnForms(),
|
||||
|
||||
@@ -11,6 +11,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rules;
|
||||
use Laravel\Nova\Fields\BelongsToMany;
|
||||
use Laravel\Nova\Fields\Boolean;
|
||||
use Laravel\Nova\Fields\Hidden;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\MorphToMany;
|
||||
use Laravel\Nova\Fields\Password;
|
||||
@@ -106,6 +107,10 @@ class User extends Resource
|
||||
->creationRules('required', Rules\Password::defaults())
|
||||
->updateRules('nullable', Rules\Password::defaults()),
|
||||
|
||||
Hidden::make('password_must_be_changed')
|
||||
->default(true)
|
||||
->hideWhenUpdating(),
|
||||
|
||||
Boolean::make(__('Phone verified'), 'phone_verified_at')
|
||||
->default(false)
|
||||
->fillUsing(function (NovaRequest $request, $model, string $attribute, string $requestAttribute) {
|
||||
|
||||
@@ -12,7 +12,7 @@ return new class extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('loan_remaining_orders', function (Blueprint $table) {
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('user_id')->nullable()->constrained()->cascadeOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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::table('users', function (Blueprint $table) {
|
||||
$table->boolean('password_must_be_changed')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('password_must_be_changed');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user