Update ParentalControlsController

This commit is contained in:
Daniel Supernault 2024-01-11 06:31:19 -07:00
parent 71c148c61e
commit c7ed684a5c
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

View file

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\ParentalControls; use App\Models\ParentalControls;
use App\Models\UserRoles; use App\Models\UserRoles;
use App\Profile;
use App\User; use App\User;
use App\Http\Controllers\Auth\RegisterController; use App\Http\Controllers\Auth\RegisterController;
use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Events\Registered;
@ -65,6 +66,11 @@ class ParentalControlsController extends Controller
$pc->save(); $pc->save();
$roles = UserRoleService::mapActions($pc->child_id, $ff); $roles = UserRoleService::mapActions($pc->child_id, $ff);
if(isset($roles['account-force-private'])) {
$c = Profile::whereUserId($pc->child_id)->first();
$c->is_private = $roles['account-force-private'];
$c->save();
}
UserRoles::whereUserId($pc->child_id)->update(['roles' => $roles]); UserRoles::whereUserId($pc->child_id)->update(['roles' => $roles]);
return redirect($pc->manageUrl() . '?permissions'); return redirect($pc->manageUrl() . '?permissions');
} }