shell bypass 403

UnknownSec Shell


name : ProductBadgeContentsController.php
<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\ProductBadge;
use App\Models\ProductBadgeContent;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;

class ProductBadgeContentsController extends Controller
{

    public function getForm($badgeId)
    {
        $this->authorize("admin_product_badges_create");
        $badge = ProductBadge::query()->findOrFail($badgeId);

        $data = [
            'badge' => $badge,
        ];

        $html = (string)view()->make("admin.product_badges.create.content_modal", $data);

        return response()->json([
            'code' => 200,
            'html' => $html
        ]);
    }

    public function store(Request $request, $badgeId)
    {
        $this->authorize("admin_product_badges_create");
        $badge = ProductBadge::query()->findOrFail($badgeId);

        $data = $request->all();

        $validator = Validator::make($data, [
            'type' => 'required',
            'course' => 'required_if:type,course',
            'product' => 'required_if:type,product',
            'bundle' => 'required_if:type,bundle',
            'blog_article' => 'required_if:type,blog_article',
            'upcoming_course' => 'required_if:type,upcoming_course',
        ]);

        if ($validator->fails()) {
            return response([
                'code' => 422,
                'errors' => $validator->errors(),
            ], 422);
        }


        $targetId = $data[$data['type']];
        $targetType = $this->getTargetType($data);

        $check = ProductBadgeContent::query()
            ->where('product_badge_id', $badge->id)
            ->where('targetable_type', $targetType)
            ->where('targetable_id', $targetId)
            ->first();

        if (!empty($check)) {
            return response([
                'code' => 422,
                'errors' => [
                    "{$data['type']}" => [trans('validation.unique', ['attribute' => trans("update.{$data['type']}")])]
                ],
            ], 422);
        }

        ProductBadgeContent::query()->create([
            'product_badge_id' => $badge->id,
            'targetable_id' => $targetId,
            'targetable_type' => $targetType,
        ]);

        return response()->json([
            'code' => 200,
            'title' => trans('public.request_success'),
            'msg' => trans('update.badge_content_created_successfully'),
        ]);
    }


    public function delete($badgeId, $contentId)
    {
        $this->authorize("admin_product_badges_create");
        $badge = ProductBadge::query()->findOrFail($badgeId);

        $content = ProductBadgeContent::query()
            ->where('id', $contentId)
            ->where('product_badge_id', $badge->id)
            ->first();

        if (!empty($content)) {
            $content->delete();

            return redirect()->back();
        }

        abort(404);

    }

    private function getTargetType($data)
    {
        $type = "";

        switch ($data["type"]) {
            case "course":
                $type = "App\Models\Webinar";
                break;

            case "bundle":
                $type = "App\Models\Bundle";
                break;

            case "product":
                $type = "App\Models\Product";
                break;

            case "blog_article":
                $type = "App\Models\Blog";
                break;

            case "upcoming_course":
                $type = "App\Models\UpcomingCourse";
                break;
        }

        return $type;
    }
}

© 2025 UnknownSec
Courses | Anyleson - Learning Platform
INR (₹)
India Rupee
$
United States Dollar

Courses

17 Courses
Course
Full Stack Web Development

Full Stack Web Development

in Web Development
83:20 Hours
10 Oct 2024
₹28,318.82
Course
Installment and Secure Host

Installment and Secure Host

in Business Strategy
5.00
1:30 Hours
16 Mar 2023
₹118
Course
New Update Features

New Update Features

in Language
4.00
1:30 Hours
21 Jun 2022
Free
Not conducted
Bestseller
New In-App Live System

New In-App Live System

in Communications
5.00
2:30 Hours
1 Mar 2026
₹11.80
Featured
New Learning Page

New Learning Page

in Lifestyle
5.00
3:30 Hours
1 Mar 2022
Free
Finished
How to Travel Around the World

How to Travel Around the World

in Lifestyle
5.00
2:30 Hours
2 Mar 2022
₹29.50

Type

More options