Skip to content

Commit

Permalink
fix(profile): Fixed error on saving profile data
Browse files Browse the repository at this point in the history
  • Loading branch information
anibalealvarezs committed Feb 11, 2022
1 parent dd21137 commit ef4d10a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/Commands/PbAltInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class PbAltInstallCommand extends Command
{--update : pachage will be updated before installation}
{--publish : Resources will be published to the application}
{--migrate : Migrations will be run}
{--reset : Migrations will be removed from migrations directory}
{--seed : Tables will be seeded}
{--config : Application wil be configured}
{--link : Links will be created}
Expand Down
1 change: 0 additions & 1 deletion src/Commands/PbInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class PbInstallCommand extends Command
{--update : pachage will be updated before installation}
{--publish : Resources will be published to the application}
{--migrate : Migrations will be run}
{--reset : Migrations will be removed from migrations directory}
{--seed : Tables will be seeded}
{--config : Application wil be configured}
{--link : Links will be created}
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/Fortify/PbProfileInformationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function update(Request $request,
{
$updater->update($request->user(), $request->all());

$current = app(PbCurrentUser::class);
$current = PbUser::find($request->user()->id);
if ($language = PbLanguage::find($request->input('language'))) {
$current->language_id = $language->id;
$request->session()->put('locale', $language->code);
Expand Down
4 changes: 2 additions & 2 deletions src/Controllers/PbBuilderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function store(Request $request): Redirector|RedirectResponse|Application
$model = $this->processModelRequests($this->vars->validationRules, $request, $this->vars->replacers,
(new $this->vars->level->modelPath())->setLocale(app()->getLocale()));
// Check if module relation exists
if ($model->hasRelation('module') && $request->input('module') && $module = PbModule::find($request->input('module'))) {
if ($model->hasRelation('module') && ($request->input('module') > 0) && $module = PbModule::find($request->input('module'))) {
$model->module()->associate($module);
}
// Model save
Expand Down Expand Up @@ -268,7 +268,7 @@ public function update(Request $request, int $id): Redirector|RedirectResponse|A
// Build requests
$requests = $this->processModelRequests($this->vars->validationRules, $request, $this->vars->replacers);
// Check if module relation exists
if ($model->hasRelation('module') && $request->input('module') && $module = PbModule::find($request->input('module'))) {
if ($model->hasRelation('module') && ($request->input('module') > 0) && $module = PbModule::find($request->input('module'))) {
$model->module()->associate($module);
}
// Model update
Expand Down
4 changes: 2 additions & 2 deletions src/Controllers/Permission/PbPermissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function store(Request $request): Redirector|RedirectResponse|Application
// Add additional fields values
$model->guard_name = 'admin';
// Check if module relation exists
if ($model->hasRelation('module') && $request->input('module') && $module = PbModule::find($request->input('module'))) {
if ($model->hasRelation('module') && ($request->input('module') > 0) && $module = PbModule::find($request->input('module'))) {
$model->module()->associate($module);
}
// Model save
Expand Down Expand Up @@ -226,7 +226,7 @@ public function update(Request $request, int $id): Redirector|RedirectResponse|A
// Build requests
$requests = $this->processModelRequests($this->vars->validationRules, $request, $this->vars->replacers);
// Check if module relation exists
if ($model->hasRelation('module') && $request->input('module') && $module = PbModule::find($request->input('module'))) {
if ($model->hasRelation('module') && ($request->input('module') > 0) && $module = PbModule::find($request->input('module'))) {
$model->module()->associate($module);
}
// Model update
Expand Down

0 comments on commit ef4d10a

Please sign in to comment.