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
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" fill="none"
class="mx-auto size-10">
<path d="M22.9609 43.0459H41.0362" stroke="black" stroke-width="4" stroke-miterlimit="10"
stroke-linecap="round" stroke-linejoin="round" />
<mask id="mask0_1_8308" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0"
width="64" height="64">
<path d="M0 7.62939e-06H64V64H0V7.62939e-06Z" fill="white" />
</mask>
<g mask="url(#mask0_1_8308)">
<path
d="M53.0874 43.0459H57.104C59.8655 43.0459 62.125 40.7864 62.125 38.0251V37.0208C62.125 31.498 57.6061 26.9793 52.0832 26.9793H6.89575C4.13438 26.9793 1.875 29.2385 1.875 32V38.0251C1.875 40.7864 4.13438 43.0459 6.89575 43.0459H10.9129"
stroke="black" stroke-width="4" stroke-miterlimit="10" stroke-linecap="round"
stroke-linejoin="round" />
<path d="M22.9609 43.0459H41.0363" stroke="black" stroke-width="4" stroke-miterlimit="10"
stroke-linecap="round" stroke-linejoin="round" />
<path d="M29.9921 14.9292V26.9792" stroke="black" stroke-width="4" stroke-miterlimit="10"
stroke-linecap="round" stroke-linejoin="round" />
<path
d="M50.0729 26.9792L46.2931 19.4201C45.0585 16.9502 41.7885 14.9292 39.027 14.9292H20.9521C18.1906 14.9292 14.9208 16.9502 13.6861 19.4201L9.90625 26.9792"
stroke="black" stroke-width="4" stroke-miterlimit="10" stroke-linecap="round"
stroke-linejoin="round" />
<path
d="M53.0886 43.0459C53.0886 46.3733 50.3908 49.0708 47.0639 49.0708C43.7369 49.0708 41.0391 46.3733 41.0391 43.0459C41.0391 39.7183 43.7369 37.0208 47.0639 37.0208C50.3908 37.0208 53.0886 39.7183 53.0886 43.0459Z"
stroke="black" stroke-width="4" stroke-miterlimit="10" stroke-linecap="round"
stroke-linejoin="round" />
<path
d="M22.9637 43.0459C22.9637 46.3733 20.2659 49.0708 16.9391 49.0708C13.6121 49.0708 10.9141 46.3733 10.9141 43.0459C10.9141 39.7183 13.6121 37.0208 16.9391 37.0208C20.2659 37.0208 22.9637 39.7183 22.9637 43.0459Z"
stroke="black" stroke-width="4" stroke-miterlimit="10" stroke-linecap="round"
stroke-linejoin="round" />
<path d="M61.9188 35.0125H59.1094" stroke="black" stroke-width="4" stroke-miterlimit="10"
stroke-linecap="round" stroke-linejoin="round" />
<path d="M33.0004 35.0125H30.9922" stroke="black" stroke-width="4" stroke-miterlimit="10"
stroke-linecap="round" stroke-linejoin="round" />
</g>
</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.
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