Loan Order
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
|
use Laravel\Nova\Actions\ActionEvent;
|
||||||
|
|
||||||
class EventType
|
class EventType
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -56,9 +58,27 @@ class EventType
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Laravel nova events
|
||||||
|
*/
|
||||||
|
public static function laravelNovaEvents(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
self::laravelNovaActionEvent(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Laravel nova action event
|
||||||
|
*/
|
||||||
|
public static function laravelNovaActionEvent(): string
|
||||||
|
{
|
||||||
|
return ActionEvent::class;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Guest the event
|
* Guest the event
|
||||||
* @param object $event
|
* @param string|object $event
|
||||||
*/
|
*/
|
||||||
public static function guessEvent(string|object $event): string
|
public static function guessEvent(string|object $event): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Events\EventType;
|
||||||
use App\Models\System\Verification;
|
use App\Models\System\Verification;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\Psr7\Request as GuzzleRequest;
|
use GuzzleHttp\Psr7\Request as GuzzleRequest;
|
||||||
@@ -67,7 +68,7 @@ function storeAuthEvent(string $name, Request $request): void
|
|||||||
{
|
{
|
||||||
Log::channel('auth_activity')
|
Log::channel('auth_activity')
|
||||||
->info(sprintf(
|
->info(sprintf(
|
||||||
'%s, APP_NAME: %s, REQUEST_TYPE: %s, SOURCE_IP: %s, SOURCE_PORT: %s, SOURCE_URL: %s, DESTINATION_IP: %s, DESTINATION_PORT: %s, DESTINATION_COUNTRY: %s',
|
'%s, APP_NAME: %s, REQUEST_TYPE: %s, SOURCE_IP: %s, SOURCE_PORT: %s, SOURCE_URL: %s, DESTINATION_IP: %s, DESTINATION_PORT: %s, DESTINATION_COUNTRY: %s, USER_ID: %s',
|
||||||
$name,
|
$name,
|
||||||
config('app.name'),
|
config('app.name'),
|
||||||
$request->method(),
|
$request->method(),
|
||||||
@@ -77,5 +78,45 @@ function storeAuthEvent(string $name, Request $request): void
|
|||||||
$request->host(),
|
$request->host(),
|
||||||
$request->getPort(),
|
$request->getPort(),
|
||||||
'tk',
|
'tk',
|
||||||
|
$request->user()->id ?? '-',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store resource events
|
||||||
|
*/
|
||||||
|
function storeResourceEvent(string $name, array $data, Request $request): void
|
||||||
|
{
|
||||||
|
if ($name === EventType::laravelNovaActionEvent() || empty($data)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$before = [];
|
||||||
|
$after = [];
|
||||||
|
foreach ($data[0]->getChanges() as $key => $value) {
|
||||||
|
$before[] = [$key => $data[0]->getOriginal()[$key]];
|
||||||
|
$after[] = [$key => $value];
|
||||||
|
}
|
||||||
|
|
||||||
|
Log::channel('resource_activity')
|
||||||
|
->info(sprintf(
|
||||||
|
'%s, APP_NAME: %s, REQUEST_TYPE: %s, SOURCE_IP: %s, SOURCE_PORT: %s, SOURCE_URL: %s, DESTINATION_IP: %s, DESTINATION_PORT: %s, DESTINATION_COUNTRY: %s, USER_ID: %s, MODEL_NAME: %s, BEFORE: %s, AFTER: %s',
|
||||||
|
$name,
|
||||||
|
config('app.name'),
|
||||||
|
$request->method(),
|
||||||
|
$request->ip(),
|
||||||
|
$_SERVER['REMOTE_PORT'],
|
||||||
|
$request->url(),
|
||||||
|
$request->host(),
|
||||||
|
$request->getPort(),
|
||||||
|
'tk',
|
||||||
|
$request->user()->id ?? '-',
|
||||||
|
get_class($data[0]),
|
||||||
|
json_encode($before),
|
||||||
|
json_encode($after),
|
||||||
|
));
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Log::error('Error in storeResourceEvent() helpers', $e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use App\Repos\System\Settings\Location\RegionRepo;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Laravel\Nova\Fields\ID;
|
use Laravel\Nova\Fields\ID;
|
||||||
use Laravel\Nova\Fields\Select;
|
use Laravel\Nova\Fields\Select;
|
||||||
|
use Laravel\Nova\Fields\Boolean;
|
||||||
use Laravel\Nova\Fields\Text;
|
use Laravel\Nova\Fields\Text;
|
||||||
use Laravel\Nova\Fields\Textarea;
|
use Laravel\Nova\Fields\Textarea;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
@@ -94,7 +95,7 @@ class Branch extends Resource
|
|||||||
|
|
||||||
Textarea::make(__('Address'), 'address'),
|
Textarea::make(__('Address'), 'address'),
|
||||||
|
|
||||||
NovaSwitcher::make(__('Active'), 'active')
|
Boolean::make(__('Active'), 'active')
|
||||||
->default(true),
|
->default(true),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use App\Nova\Resource;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Laravel\Nova\Fields\ID;
|
use Laravel\Nova\Fields\ID;
|
||||||
use Laravel\Nova\Fields\Text;
|
use Laravel\Nova\Fields\Text;
|
||||||
|
use Laravel\Nova\Fields\Boolean;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
use Trin4ik\NovaSwitcher\NovaSwitcher;
|
use Trin4ik\NovaSwitcher\NovaSwitcher;
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ class CardState extends Resource
|
|||||||
Text::make(__('Notes'), 'notes')
|
Text::make(__('Notes'), 'notes')
|
||||||
->rules('nullable', 'string', 'max:255'),
|
->rules('nullable', 'string', 'max:255'),
|
||||||
|
|
||||||
NovaSwitcher::make(__('Active'), 'active')
|
Boolean::make(__('Active'), 'active')
|
||||||
->default(true),
|
->default(true),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use Laravel\Nova\Fields\ID;
|
|||||||
use Laravel\Nova\Fields\Text;
|
use Laravel\Nova\Fields\Text;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
use Trin4ik\NovaSwitcher\NovaSwitcher;
|
use Trin4ik\NovaSwitcher\NovaSwitcher;
|
||||||
|
use Laravel\Nova\Fields\Boolean;
|
||||||
|
|
||||||
class CardType extends Resource
|
class CardType extends Resource
|
||||||
{
|
{
|
||||||
@@ -69,7 +70,7 @@ class CardType extends Resource
|
|||||||
Text::make(__('Notes'), 'notes')
|
Text::make(__('Notes'), 'notes')
|
||||||
->rules('nullable', 'string', 'max:255'),
|
->rules('nullable', 'string', 'max:255'),
|
||||||
|
|
||||||
NovaSwitcher::make(__('Active'), 'active')
|
Boolean::make(__('Active'), 'active')
|
||||||
->default(true),
|
->default(true),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,51 +165,6 @@ class LoanOrder extends Resource
|
|||||||
Text::make(__('Note'), 'notes')
|
Text::make(__('Note'), 'notes')
|
||||||
->fullWidth()
|
->fullWidth()
|
||||||
->canSeeWhen('systemUser', $this),
|
->canSeeWhen('systemUser', $this),
|
||||||
Text::make(__('Note'), 'notes')
|
|
||||||
->fullWidth()
|
|
||||||
->canSeeWhen('systemUser', $this),
|
|
||||||
Text::make(__('Note'), 'notes')
|
|
||||||
->fullWidth()
|
|
||||||
->canSeeWhen('systemUser', $this),
|
|
||||||
Text::make(__('Note'), 'notes')
|
|
||||||
->fullWidth()
|
|
||||||
->canSeeWhen('systemUser', $this),
|
|
||||||
Text::make(__('Note'), 'notes')
|
|
||||||
->fullWidth()
|
|
||||||
->canSeeWhen('systemUser', $this),
|
|
||||||
Text::make(__('Note'), 'notes')
|
|
||||||
->fullWidth()
|
|
||||||
->canSeeWhen('systemUser', $this),
|
|
||||||
Text::make(__('Note'), 'notes')
|
|
||||||
->fullWidth()
|
|
||||||
->canSeeWhen('systemUser', $this),
|
|
||||||
Text::make(__('Note'), 'notes')
|
|
||||||
->fullWidth()
|
|
||||||
->canSeeWhen('systemUser', $this),
|
|
||||||
Text::make(__('Note'), 'notes')
|
|
||||||
->fullWidth()
|
|
||||||
->canSeeWhen('systemUser', $this),
|
|
||||||
Text::make(__('Note'), 'notes')
|
|
||||||
->fullWidth()
|
|
||||||
->canSeeWhen('systemUser', $this),
|
|
||||||
Text::make(__('Note'), 'notes')
|
|
||||||
->fullWidth()
|
|
||||||
->canSeeWhen('systemUser', $this),
|
|
||||||
Text::make(__('Note'), 'notes')
|
|
||||||
->fullWidth()
|
|
||||||
->canSeeWhen('systemUser', $this),
|
|
||||||
Text::make(__('Note'), 'notes')
|
|
||||||
->fullWidth()
|
|
||||||
->canSeeWhen('systemUser', $this),
|
|
||||||
Text::make(__('Note'), 'notes')
|
|
||||||
->fullWidth()
|
|
||||||
->canSeeWhen('systemUser', $this),
|
|
||||||
Text::make(__('Note'), 'notes')
|
|
||||||
->fullWidth()
|
|
||||||
->canSeeWhen('systemUser', $this),
|
|
||||||
Text::make(__('Note'), 'notes')
|
|
||||||
->fullWidth()
|
|
||||||
->canSeeWhen('systemUser', $this),
|
|
||||||
]),
|
]),
|
||||||
|
|
||||||
new Panel(__('Loan'), [
|
new Panel(__('Loan'), [
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use App\Nova\Resource;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Laravel\Nova\Fields\ID;
|
use Laravel\Nova\Fields\ID;
|
||||||
use Laravel\Nova\Fields\Number;
|
use Laravel\Nova\Fields\Number;
|
||||||
|
use Laravel\Nova\Fields\Boolean;
|
||||||
use Laravel\Nova\Fields\Text;
|
use Laravel\Nova\Fields\Text;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
use Trin4ik\NovaSwitcher\NovaSwitcher;
|
use Trin4ik\NovaSwitcher\NovaSwitcher;
|
||||||
@@ -74,7 +75,7 @@ class LoanType extends Resource
|
|||||||
Text::make(__('Notes'), 'notes')
|
Text::make(__('Notes'), 'notes')
|
||||||
->rules('required', 'string', 'max:255'),
|
->rules('required', 'string', 'max:255'),
|
||||||
|
|
||||||
NovaSwitcher::make(__('Active'), 'active')
|
Boolean::make(__('Active'), 'active')
|
||||||
->default(true),
|
->default(true),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use App\Nova\Filters\RegionFilter;
|
|||||||
use App\Nova\Resource;
|
use App\Nova\Resource;
|
||||||
use App\Repos\System\Settings\Location\RegionRepo;
|
use App\Repos\System\Settings\Location\RegionRepo;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Laravel\Nova\Fields\Boolean;
|
||||||
use Laravel\Nova\Fields\ID;
|
use Laravel\Nova\Fields\ID;
|
||||||
use Laravel\Nova\Fields\Select;
|
use Laravel\Nova\Fields\Select;
|
||||||
use Laravel\Nova\Fields\Text;
|
use Laravel\Nova\Fields\Text;
|
||||||
@@ -75,7 +76,7 @@ class Province extends Resource
|
|||||||
->translatable()
|
->translatable()
|
||||||
->rules('required', 'string', 'max:255'),
|
->rules('required', 'string', 'max:255'),
|
||||||
|
|
||||||
NovaSwitcher::make(__('Active'), 'active')
|
Boolean::make(__('Active'), 'active')
|
||||||
->default(true),
|
->default(true),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ use Laravel\Nova\Fields\HasMany;
|
|||||||
use Laravel\Nova\Fields\ID;
|
use Laravel\Nova\Fields\ID;
|
||||||
use Laravel\Nova\Fields\MorphToMany;
|
use Laravel\Nova\Fields\MorphToMany;
|
||||||
use Laravel\Nova\Fields\Password;
|
use Laravel\Nova\Fields\Password;
|
||||||
|
use Laravel\Nova\Fields\Boolean;
|
||||||
use Laravel\Nova\Fields\Text;
|
use Laravel\Nova\Fields\Text;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
use Nurmuhammet\NovaInputmask\NovaInputmask;
|
use Nurmuhammet\NovaInputmask\NovaInputmask;
|
||||||
@@ -108,7 +109,7 @@ class User extends Resource
|
|||||||
->creationRules('required', Rules\Password::defaults())
|
->creationRules('required', Rules\Password::defaults())
|
||||||
->updateRules('nullable', Rules\Password::defaults()),
|
->updateRules('nullable', Rules\Password::defaults()),
|
||||||
|
|
||||||
NovaSwitcher::make(__('Active'), 'active')
|
Boolean::make(__('Active'), 'active')
|
||||||
->default(true)
|
->default(true)
|
||||||
->canSeeWhen('isAdmin', $this),
|
->canSeeWhen('isAdmin', $this),
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\Event;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
@@ -21,5 +22,9 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
Model::shouldBeStrict(! app()->isProduction());
|
Model::shouldBeStrict(! app()->isProduction());
|
||||||
|
|
||||||
|
Event::listen(['eloquent.created: *', 'eloquent.updated: *', 'eloquent.deleted: *'], function(string $eventName, array $data) {
|
||||||
|
storeResourceEvent($eventName, $data, request());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,6 +134,13 @@ return [
|
|||||||
'replace_placeholders' => true,
|
'replace_placeholders' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'resource_activity' => [
|
||||||
|
'driver' => 'single',
|
||||||
|
'path' => storage_path('logs/resource_activity.log'),
|
||||||
|
'level' => 'info',
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
'halkbank_payment_error' => [
|
'halkbank_payment_error' => [
|
||||||
'driver' => 'single',
|
'driver' => 'single',
|
||||||
'path' => storage_path('logs/halkbank_payment_error.log'),
|
'path' => storage_path('logs/halkbank_payment_error.log'),
|
||||||
|
|||||||
Reference in New Issue
Block a user