Skip to content

Instantly share code, notes, and snippets.

@uluumbch
Last active September 25, 2025 22:45
Show Gist options
  • Select an option

  • Save uluumbch/3034514732e03374ae3230c2cba757b7 to your computer and use it in GitHub Desktop.

Select an option

Save uluumbch/3034514732e03374ae3230c2cba757b7 to your computer and use it in GitHub Desktop.
Belajar Laravel pemula
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
<svg xmlns="http://www.w3.org/2000/svg" width="46" height="30" viewBox="0 0 46 30" fill="none">
<path d="M45.3383 16.8956C45.0008 13.1072 44.4448 12.3694 44.2348 12.0919C43.752 11.4506 42.9795 11.0316 42.162 10.5919C42.1158 10.5674 42.0759 10.5326 42.0454 10.4901C42.015 10.4476 41.9948 10.3985 41.9865 10.3469C41.9783 10.2953 41.9821 10.2424 41.9977 10.1925C42.0134 10.1426 42.0404 10.097 42.0767 10.0594C42.2281 9.90584 42.3445 9.72134 42.4178 9.51856C42.4911 9.31579 42.5196 9.09954 42.5014 8.88469C42.4661 8.5037 42.289 8.14987 42.0051 7.89339C41.7211 7.6369 41.3512 7.49649 40.9686 7.5H39.5061C39.4434 7.50037 39.3808 7.50444 39.3186 7.51219C39.2759 7.49367 39.2317 7.47893 39.1864 7.46813C38.3201 5.63719 37.1342 3.13031 34.6761 1.90687C31.0301 0.0937496 24.3139 0 23.0014 0C21.6889 0 14.9726 0.0937498 11.3314 1.90406C8.87327 3.1275 7.68733 5.63438 6.82108 7.46531L6.81358 7.48031C6.77038 7.48639 6.72795 7.49708 6.68702 7.51219C6.62481 7.50444 6.56221 7.50037 6.49952 7.5H5.03421C4.65161 7.49649 4.28166 7.6369 3.99774 7.89339C3.71381 8.14987 3.53665 8.5037 3.5014 8.88469C3.48474 9.09904 3.51457 9.31446 3.58884 9.51623C3.6631 9.71799 3.78006 9.90135 3.93171 10.0538C3.96799 10.0914 3.99502 10.137 4.01067 10.1869C4.02632 10.2368 4.03016 10.2896 4.02189 10.3413C4.01361 10.3929 3.99345 10.4419 3.963 10.4844C3.93254 10.527 3.89263 10.5618 3.8464 10.5863C3.0289 11.0287 2.25265 11.4478 1.77358 12.0863C1.56358 12.3675 1.00858 13.1016 0.670145 16.89C0.482645 19.0219 0.45452 21.2288 0.601707 22.65C0.910145 25.6031 1.48858 27.3881 1.51296 27.4622C1.60172 27.7317 1.76511 27.9705 1.98415 28.1509C2.2032 28.3313 2.46892 28.4458 2.75046 28.4812V28.5C2.75046 28.8978 2.90849 29.2794 3.1898 29.5607C3.4711 29.842 3.85263 30 4.25046 30H9.50046C9.89828 30 10.2798 29.842 10.5611 29.5607C10.8424 29.2794 11.0005 28.8978 11.0005 28.5C11.8076 28.5 12.3692 28.3556 12.9645 28.2019C13.824 27.9703 14.7025 27.8162 15.5895 27.7416C18.4498 27.4688 21.2942 27.375 23.0014 27.375C24.6739 27.375 27.6439 27.4688 30.5089 27.7416C31.3994 27.8164 32.2814 27.9711 33.1442 28.2038C33.7142 28.35 34.2551 28.485 35.0042 28.4991C35.0042 28.8969 35.1622 29.2784 35.4436 29.5597C35.7249 29.841 36.1064 29.9991 36.5042 29.9991H41.7542C42.152 29.9991 42.5336 29.841 42.8149 29.5597C43.0962 29.2784 43.2542 28.8969 43.2542 28.4991V28.4878C43.5364 28.4531 43.8029 28.3388 44.0227 28.1584C44.2425 27.978 44.4064 27.7388 44.4955 27.4688C44.5198 27.3947 45.0983 25.6097 45.4067 22.6566C45.5539 21.2344 45.5276 19.0312 45.3383 16.8956ZM9.53233 8.74781C10.2823 7.15406 11.1401 5.35031 12.6673 4.59C14.8742 3.49125 19.4483 2.99625 23.0014 2.99625C26.5545 2.99625 31.1286 3.4875 33.3355 4.59C34.8626 5.35031 35.7167 7.155 36.4705 8.74781L36.5642 8.95125C36.619 9.06707 36.6433 9.19499 36.6346 9.32284C36.6259 9.45068 36.5847 9.57417 36.5147 9.68153C36.4448 9.78889 36.3485 9.87654 36.2351 9.93612C36.1216 9.9957 35.9948 10.0252 35.8667 10.0219C32.7514 9.9375 26.1889 9.6675 23.0014 9.6675C19.8139 9.6675 13.2514 9.94406 10.1314 10.0284C10.0033 10.0318 9.87649 10.0023 9.76305 9.94268C9.64961 9.8831 9.55333 9.79545 9.48338 9.68809C9.41344 9.58073 9.37216 9.45724 9.3635 9.3294C9.35484 9.20156 9.37907 9.07363 9.4339 8.95781C9.46671 8.88844 9.5014 8.81812 9.53233 8.74781ZM10.6508 16.2131C9.03809 16.4072 7.41509 16.503 5.79077 16.5C4.79702 16.5 3.77233 16.2188 3.58202 15.3337C3.45171 14.7384 3.46577 14.4038 3.53608 14.0672C3.59514 13.7812 3.6889 13.5731 4.15765 13.5C5.3764 13.3125 6.05796 13.5478 8.05296 14.1356C9.37577 14.5247 10.3301 15.0431 10.8739 15.4537C11.1467 15.6562 11.0014 16.185 10.6508 16.2131ZM31.4051 23.9006C30.1714 24.0413 27.7039 23.9897 23.0295 23.9897C18.3551 23.9897 15.8886 24.0413 14.6548 23.9006C13.3817 23.7591 11.7589 22.5553 12.867 21.4828C13.6048 20.7759 15.3261 20.2472 17.6183 19.95C19.9105 19.6528 20.8808 19.5 23.0201 19.5C25.1595 19.5 26.0314 19.5938 28.422 19.9509C30.8126 20.3081 32.6192 20.8434 33.1733 21.4837C34.1839 22.6313 32.6773 23.7516 31.4051 23.9062V23.9006ZM42.4208 15.3328C42.2333 16.2216 41.202 16.4991 40.212 16.4991C38.5566 16.4994 36.9026 16.4037 35.2583 16.2122C34.9714 16.185 34.8383 15.6816 35.1289 15.4528C35.6642 15.0319 36.6289 14.5238 37.9498 14.1347C39.9448 13.5469 41.0951 13.3116 42.0833 13.5075C42.3242 13.5553 42.4517 13.8141 42.4667 13.9762C42.5328 14.4278 42.5173 14.8877 42.4208 15.3337V15.3328Z" fill="black"/>
</svg>
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Gunakan template berikut untuk membuat admin panel

buat file baru di resources/views/layouts/admin.blade.php

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin Panel</title>
    @vite('resources/css/app.css')
</head>

<body class="bg-slate-100 font-sans">

    <div class="relative min-h-screen md:flex">
        <!-- Mobile Nav Toggle -->
        <div class="bg-gray-800 text-gray-100 flex justify-between md:hidden">
            <a href="#" class="block p-4 text-white font-bold">Admin Panel</a>
            <button id="mobile-menu-button" class="p-4 focus:outline-none focus:bg-gray-700">
                <svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"
                    xmlns="http://www.w3.org/2000/svg">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16m-7 6h7">
                    </path>
                </svg>
            </button>
        </div>

        <!-- Sidebar -->
        <aside id="sidebar"
            class="bg-primary text-white w-64 space-y-6 py-7 px-2 absolute inset-y-0 left-0 transform -translate-x-full md:relative md:translate-x-0 transition duration-300 ease-in-out z-30">

            <!-- Logo/Header -->
            <div class="h-16 flex items-center justify-center text-2xl font-bold">
                Admin Panel
            </div>

            <!-- Navigation Links -->
            <nav>
                <ul class="flex flex-col space-y-2">
                    <li>
                        <a href=""
                            class="flex items-center p-3 rounded-lg @if(request()->routeIs('admin.dashboard')) bg-white text-purple-800 font-semibold @else hover:bg-purple-700 transition duration-200 @endif">
                            <svg class="w-6 h-6 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"
                                xmlns="http://www.w3.org/2000/svg">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                    d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6">
                                </path>
                            </svg>
                            <span>Dashboard</span>
                        </a>
                    </li>
                    <li>
                        <a href=""
                            class="flex items-center p-3 rounded-lg @if(request()->routeIs('admin.vehicle')) bg-white text-purple-800 font-semibold @else hover:bg-purple-700 transition duration-200 @endif">
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" class="w-6 h-6 mr-3">
                                <path stroke="none" d="M0 0h24v24H0z" fill="none" />
                                <path d="M7 17m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
                                <path d="M17 17m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
                                <path d="M5 17h-2v-6l2 -5h9l4 5h1a2 2 0 0 1 2 2v4h-2m-4 0h-6m-6 -6h15m-6 0v-5" />
                            </svg>
                            <span>Vehicles</span>
                        </a>
                    </li>
                    <li>
                        <a href="#"
                            class="flex items-center p-3 rounded-lg hover:bg-[#4d2fbc] transition duration-200">
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" class="w-6 h-6 mr-3">
                                <path stroke="none" d="M0 0h24v24H0z" fill="none" />
                                <path d="M10 9a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
                                <path d="M4 8v-2a2 2 0 0 1 2 -2h2" />
                                <path d="M4 16v2a2 2 0 0 0 2 2h2" />
                                <path d="M16 4h2a2 2 0 0 1 2 2v2" />
                                <path d="M16 20h2a2 2 0 0 0 2 -2v-2" />
                                <path d="M8 16a2 2 0 0 1 2 -2h4a2 2 0 0 1 2 2" />
                            </svg>
                            <span>Admin</span>
                        </a>
                    </li>
                    <li>
                        <a href=""
                            class="flex items-center p-3 rounded-lg @if(request()->routeIs('admin.profile')) bg-white text-purple-800 font-semibold @else hover:bg-purple-700 transition duration-200 @endif">
                            <svg class="w-6 h-6 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"
                                xmlns="http://www.w3.org/2000/svg">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                    d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.096 2.572-1.065z">
                                </path>
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                    d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
                            </svg>
                            <span>Settings</span>
                        </a>
                    </li>
                    <li>
                        <form action="" method="POST" 
                            class="flex items-center p-3 rounded-lg hover:bg-[#4d2fbc] transition duration-200 ">
                            @csrf
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" class="w-6 h-6 mr-3">
                                <path stroke="none" d="M0 0h24v24H0z" fill="none" />
                                <path
                                    d="M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2" />
                                <path d="M9 12h12l-3 -3" />
                                <path d="M18 15l3 -3" />
                            </svg>
                            <button type="submit" class="text-left w-full cursor-pointer">Logout</button>
                        </form>
                    </li>
                </ul>
            </nav>
        </aside>
        <!-- Main Content -->
        @yield('content')
    </div>
    <script>
        const menuButton = document.getElementById('mobile-menu-button');
        const sidebar = document.getElementById('sidebar');

        menuButton.addEventListener('click', () => {
            sidebar.classList.toggle('-translate-x-full');
        });
    </script>
</body>

</html>
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment