Peran dan Hak Akses Pengguna di Laravel

Kita akan melanjutkan tutorial dari tulisan sebelumnya yang menjelaskan bagaimana cara menerapkan peran dan hak akses di Laravel – bagian 1. Pada sesi ini, kita akan membuat sebuah blog sederhana.

CATATAN
Anda dapat melewati tahap ini jika Anda akan menggunakan model yang sudah ada pada aplikasi Anda sendiri.

Pengantar

Dalam tahap ini, kita perlu membuat aplikasi blog sederhana. Dalam blog tersebut, terdapat dua modul yaitu Modul Kategori dan Modul Tulisan. Nantinya, hak akses kedua modul tersebut dapat disesuaikan berdasarkan peran pengguna.

Membuat Model

Blog sederhana ini akan memiliki dua model, Category dan Post. Nantinya, setiap tulisan harus menentukan kategori pada saat membuat tulisan baru.

Category Model

Sekarang kita akan menambahkan model kategori tulisan dengan nama Category. Anda dapat menambahkan model baru ini melalui Artisan CLI dengan menjalankan perintah dibawah ini:

$ php artisan make:model Category --migration

Parameter --migration menandakan akan ditambahkan migrasi baru. Setelah menjalankan perintah diatas, buka model app/Category.php dan ganti beberapa bagian kode seperti dibawah ini:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Category extends Model
{
    protected $fillable = [
        'name', 'description',
    ];

    public function posts()
    {
        return $this->hasMany('App\Post');
    }
}

Setelah mengubah kode pada file app/Category.php, sekarang kita perlu mengubah file migrasi. Dimana dalam migrasi untuk model kategori ini hanya memerlukan dua field saja; name dan description.

Buka file [timestamp]_create_categories_table.php yang terletak di direktori database/migrations, kemudian tambahkan beberapa baris kode untuk membuatkan field seperti dibawah ini:

public function up()
{
    Schema::create('categories', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->string('name');
        $table->string('description')->nullable();
        $table->timestamps();
    });
}

Simpan dan tutup setelah Anda mengubah file tersebut, kemudian jalankan perintah dibawah ini untuk memproses migrasi:

$ php artisan migrate
Output:

Migrating: [timestamp]_create_categories_table
Migrated: [timestamp]_create_categories_table

Post Model

Selanjutkan kita akan menambahkan satu model lagi yaitu Post. Jalankan perintah dibawah ini untuk menambahkan model:

$ php artisan make:model Post --migration

Setelah menjalankan perintah diatas, buka model app/Post.php dan ganti beberapa bagian kode seperti dibawah ini:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    protected $fillable = [
        'title', 'content', 'category_id',
    ];

    public function category()
    {
        return $this->belongsTo('App\Category');
    }
}

Buka file [timestamp]_create_posts_table.php yang terletak di direktori database/migrations, kemudian tambahkan beberapa baris kode untuk membuatkan field seperti dibawah ini:

public function up()
{
    Schema::create('posts', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->string('title');
        $table->text('content');

        $table->bigInteger('category_id')->unsigned()->index();
        $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');

        $table->timestamps();
    });
}

Pada migrasi model Post ini terdapat relasi FK, dimana jika kategori dihapus maka Post juga akan terhapus. Dilain waktu, saya akan menjelaskan lebih lanjut tentan relasi database di Laravel. Sementara, Anda dapat mencari referensi disini.

Simpan dan tutup setelah Anda mengubah file tersebut, kemudian jalankan perintah dibawah ini untuk memproses migrasi:

$ php artisan migrate
Output:

Migrating: [timestamp]_create_posts_table
Migrated:  [timestamp]_create_posts_table

Membuat Controller

Setelah membuat model Category dan Post, kita perlu menambahkan controller untuk mengelola data kedua modul tersebut.

Category Controller

Sekarang kita tambahkan controller untuk model Category. Pada controller ini digunakan untuk menambah, mengedit dan menghapus kategori. Jalankan perintah dibawah ini untuk menambahkan controller Category:

$ php artisan make:controller CategoryController --resource

Anda akan mendapatkan file baru yang tersimpan di app/Http/Controllers dengan nama file CategoryController.php. Kemudian lakukan pengeditan kode pada file tersebut dengan kode seperti berikut:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Category;
use App\Post;

class CategoryController extends Controller
{
    public function index()
    {
        $categories = Category::all();
        return view('categories.index', ['categories' => $categories]);
    }

    public function create()
    {
        return view('categories.create');
    }

    public function store(Request $request)
    {
        $this->validate($request, [
            'name' => 'required',
        ]);

        $category = Category::create($request->only([
            'name',
            'description',
        ]));

        return redirect()->route('categories.index')->with('success', $category->name .'</u> succesfully added.');
    }

    public function show($id)
    {
        $category = Category::findOrFail($id);
        return view('categories.show', ['category' => $category]);
    }

    public function edit($id)
    {
        $category = Category::findOrFail($id);
        return view('categories.edit', ['category' => $category]);
    }

    public function update(Request $request, $id)
    {
        $this->validate($request, [
            'name' => 'required',
        ]);

        $category = Category::findOrFail($id);
        $category->fill($request->only([
            'name',
            'description',
        ]))->save();

        return redirect()->route('categories.index')->with('success', $category->name .'</u> has been updated.');
    }

    public function destroy($id)
    {
        $category = Category::findOrFail($id);
        $category->delete();

        return redirect()->route('categories.index')->with('success', $category->name .'</u> has been deleted.');
    }
}

Post Controller

Selanjutnya, tambahkan juga controller untuk Post. Jalankan perintah berikut ini untuk menambahkan model:

$ php artisan make:controller PostController --resource

Kemudian lakukan pengeditan kode pada file app/Http/Controllers/PostController.php dengan kode seperti berikut:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Category;
use App\Post;

class PostController extends Controller
{
    public function index()
    {
        $posts = Post::all();
        return view('posts.index', ['posts' => $posts]);
    }

    public function create()
    {
        $categories = Category::all();
        return view('posts.create', ['categories' => $categories]);
    }

    public function store(Request $request)
    {
        $this->validate($request, [
            'title' => 'required',
            'content' => 'required',
            'category_id' => 'required',
        ]);

        $post = Post::create($request->only([
            'title',
            'content',
            'category_id',
        ]));

        return redirect()->route('posts.index')->with('success', $post->title .'</u> succesfully added.');
    }

    public function show($id)
    {
        $post = Post::findOrFail($id);
        return view('posts.show', ['post' => $post]);
    }

    public function edit($id)
    {
        $categories = Category::all();
        $post = Post::findOrFail($id);

        return view('posts.edit', ['categories' => $categories, 'post' => $post]);
    }

    public function update(Request $request, $id)
    {
        $this->validate($request, [
            'title' => 'required',
            'content' => 'required',
            'category_id' => 'required',
        ]);

        $post = Post::findOrFail($id);
        $post->fill($request->only([
            'title',
            'content',
            'category_id',
        ]))->save();

        return redirect()->route('posts.index')->with('success', $post->title .'</u> has been updated.');
    }

    public function destroy($id)
    {
        $post = Post::findOrFail($id);
        $post->delete();

        return redirect()->route('posts.index')->with('success', $post->title .'</u> has been deleted.');
    }
}

Daftarkan Route

Untuk mendaftarkan rute Category dan Post, Anda perlu mengubah file routes/web.php, tambahkan baris berikut:

...

Route::resource('/categories', 'CategoryController');
Route::resource('/posts', 'PostController');

Membuat View

Setelah membuat model dan controller untuk blog sederhana diatas, sekarang kita akan menambahkan view untuk menampilkan dan mengelola kategori dan tulisan.

Baca Juga:  Membangun Aplikasi Dasar dengan Laravel

Category View

Buat direktori baru resources/views/categories, kemudian tambahkan file baru dengan kode dan ekstensi .blade.php sebagai berikut:

@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
                    <li class="breadcrumb-item"><a href="{{ route('categories.index') }}">Categories</a></li>
                    <li class="breadcrumb-item active" aria-current="page">Create New Category</li>
                </ol>
            </nav>

            <div class="card">
                <div class="card-header">Create New Category</div>
                <div class="card-body">
                    <form method="POST" action="{{ route('categories.store') }}">
                        @csrf

                        <div class="form-group row">
                            <label for="name" class="col-md-4 col-form-label text-md-right">Name:</label>
                            <div class="col-md-6">
                                <input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>

                                @error('name')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

                        <div class="form-group row">
                            <label for="description" class="col-md-4 col-form-label text-md-right">Description:</label>
                            <div class="col-md-6">
                                <input id="description" type="text" class="form-control @error('description') is-invalid @enderror" name="description" value="{{ old('description') }}" autocomplete="description">

                                @error('description')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

                        <div class="form-group row mb-0">
                            <div class="col-md-8 offset-md-4">
                                <button type="submit" class="btn btn-primary">Save</button>
                                <a class="btn btn-link" href="{{ route('categories.index') }}">Cancel</a>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

 


@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
                    <li class="breadcrumb-item"><a href="{{ route('categories.index') }}">Categories</a></li>
                    <li class="breadcrumb-item active" aria-current="page">Update Category</li>
                </ol>
            </nav>

            <div class="card">
                <div class="card-header">Update Category: {{ $category->name }}</div>
                <div class="card-body">
                    <form method="POST" action="{{ route('categories.update', $category->id) }}">
                        <input name="_method" type="hidden" value="PUT">
                        @csrf

                        <div class="form-group row">
                            <label for="name" class="col-md-4 col-form-label text-md-right">Name:</label>
                            <div class="col-md-6">
                                <input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ $category->name }}" autocomplete="name" autofocus>

                                @error('name')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

                        <div class="form-group row">
                            <label for="description" class="col-md-4 col-form-label text-md-right">Description:</label>
                            <div class="col-md-6">
                                <input id="description" type="text" class="form-control @error('description') is-invalid @enderror" name="description" value="{{ $category->description }}" autocomplete="description">

                                @error('description')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

                        <div class="form-group row mb-0">
                            <div class="col-md-8 offset-md-4">
                                <button type="submit" class="btn btn-primary">Save</button>
                                <a class="btn btn-link" href="{{ route('categories.index') }}">Cancel</a>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
                    <li class="breadcrumb-item active" aria-current="page">Categories</li>
                </ol>
            </nav>

            <div class="card">
                <div class="card-header"><a class="btn btn-primary btn-sm mr-2" href="{{ route('categories.create') }}">New</a> Categories</div>
                <table class="table">
                    <thead>
                        <tr>
                            <th scope="col">Name</th>
                            <th scope="col">Description</th>
                            <th scope="col" class="text-right">Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($categories as $category)
                        <tr>
                            <th scope="row">{{ $category->name }}</th>
                            <td>{{ $category->description }}</td>
                            <td class="text-right">
                                <a class="btn btn-link" href="{{ route('categories.edit', $category->id) }}">Edit</a>
                                <a class="btn btn-link" href="#" onclick="event.preventDefault(); document.getElementById('destroy-category-{{ $category->id }}').submit();">Delete</a>
                                <form id="destroy-category-{{ $category->id }}" action="{{ route('categories.destroy', $category->id) }}" method="POST" style="display: none;">
                                    {{ csrf_field() }}
                                    <input name="_method" type="hidden" value="DELETE">
                                </form>
                            </td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@endsection
@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
                    <li class="breadcrumb-item"><a href="{{ route('categories.index') }}">Categories</a></li>
                    <li class="breadcrumb-item active" aria-current="page">{{ $category->name }}</li>
                </ol>
            </nav>

            <div class="card">
                <div class="card-header">Category Details</div>

                <div class="card-body">
                    <div class="form-group row">
                        <label for="name" class="col-md-4 col-form-label text-md-right">Name:</label>
                        <div class="col-md-6">
                            <input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ $category->name }}" readonly>

                            @error('name')
                                <span class="invalid-feedback" role="alert">
                                    <strong>{{ $message }}</strong>
                                </span>
                            @enderror
                        </div>
                    </div>

                    <div class="form-group row">
                        <label for="description" class="col-md-4 col-form-label text-md-right">Description:</label>
                        <div class="col-md-6">
                            <input id="description" type="text" class="form-control @error('description') is-invalid @enderror" name="description" value="{{ $category->description }}" readonly>

                            @error('description')
                                <span class="invalid-feedback" role="alert">
                                    <strong>{{ $message }}</strong>
                                </span>
                            @enderror
                        </div>
                    </div>

                    <div class="form-group row mb-0">
                        <div class="col-md-8 offset-md-4">
                            <a class="btn btn-link" href="{{ route('categories.index') }}">Back</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
Baca Juga:  Peran dan Hak Akses di Laravel - Bagian 1

Post View

Selanjutnya, buat direktori baru resources/views/posts, kemudian tambahkan masing-masing file dibawah ini dengan kode sebagai berikut:

@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
                    <li class="breadcrumb-item"><a href="{{ route('posts.index') }}">Posts</a></li>
                    <li class="breadcrumb-item active" aria-current="page">Create New Post</li>
                </ol>
            </nav>

            <div class="card">
                <div class="card-header">Create Post</div>

                <div class="card-body">
                    <form method="POST" action="{{ route('posts.store') }}">
                        @csrf

                        <div class="form-group row">
                            <label for="title" class="col-md-4 col-form-label text-md-right">Title:</label>
                            <div class="col-md-6">
                                <input id="title" type="text" class="form-control @error('title') is-invalid @enderror" name="title" value="{{ old('title') }}" required autocomplete="title" autofocus>

                                @error('title')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

                        <div class="form-group row">
                            <label for="content" class="col-md-4 col-form-label text-md-right">Content:</label>
                            <div class="col-md-6">
                                <textarea class="form-control" class="form-control @error('content') is-invalid @enderror" id="content" name="content" rows="6" required>{{ old('content') }}</textarea>

                                @error('content')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

                        <div class="form-group row">
                            <label for="category_id" class="col-md-4 col-form-label text-md-right">Choose Category:</label>
                            <div class="col-md-6">
                                <select class="form-control" class="form-control @error('content') is-invalid @enderror" id="category_id" name="category_id" required>
                                    @foreach($categories as $category)
                                    <option value="{{ $category->id }}">{{ $category->name }}</option>
                                    @endforeach
                                </select>

                                @error('category_id')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

                        <div class="form-group row mb-0">
                            <div class="col-md-8 offset-md-4">
                                <button type="submit" class="btn btn-primary">Save</button>
                                <a class="btn btn-link" href="{{ route('posts.index') }}">Cancel</a>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
                    <li class="breadcrumb-item"><a href="{{ route('posts.index') }}">Posts</a></li>
                    <li class="breadcrumb-item active" aria-current="page">Update Post</li>
                </ol>
            </nav>

            <div class="card">
                <div class="card-header">Update Post: {{ $post->title }}</div>
                <div class="card-body">
                    <form method="POST" action="{{ route('posts.update', $post->id) }}">
                        <input name="_method" type="hidden" value="PUT">
                        @csrf

                        <div class="form-group row">
                            <label for="title" class="col-md-4 col-form-label text-md-right">Title:</label>
                            <div class="col-md-6">
                                <input id="title" type="text" class="form-control @error('title') is-invalid @enderror" name="title" value="{{ $post->title }}" required autocomplete="title" autofocus>

                                @error('title')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

                        <div class="form-group row">
                            <label for="content" class="col-md-4 col-form-label text-md-right">Content:</label>
                            <div class="col-md-6">
                                <textarea class="form-control" class="form-control @error('content') is-invalid @enderror" id="content" name="content" rows="6" required>{{ $post->content }}</textarea>

                                @error('content')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

                        <div class="form-group row">
                            <label for="category_id" class="col-md-4 col-form-label text-md-right">Choose Category:</label>
                            <div class="col-md-6">
                                <select class="form-control" class="form-control @error('content') is-invalid @enderror" id="category_id" name="category_id" required>
                                    @foreach($categories as $category)
                                    <option value="{{ $category->id }}" @if($category->id == $post->category_id) selected @endif>{{ $category->name }}</option>
                                    @endforeach
                                </select>

                                @error('category_id')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

                        <div class="form-group row mb-0">
                            <div class="col-md-8 offset-md-4">
                                <button type="submit" class="btn btn-primary">Save</button>
                                <a class="btn btn-link" href="{{ route('posts.index') }}">Cancel</a>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
                    <li class="breadcrumb-item active" aria-current="page">Posts</li>
                </ol>
            </nav>

            <div class="card">
                <div class="card-header"><a class="btn btn-primary btn-sm mr-2" href="{{ route('posts.create') }}">New</a> Posts</div>
                <table class="table">
                    <thead>
                        <tr>
                            <th scope="col">Title</th>
                            <th scope="col">Content</th>
                            <th scope="col">Category</th>
                            <th scope="col" class="text-right">Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($posts as $post)
                        <tr>
                            <th scope="row">{{ $post->title }}</th>
                            <td>{{ $post->content }}</td>
                            <td>{{ $post->category->name }}</td>
                            <td class="text-right">
                                <a class="btn btn-link" href="{{ route('posts.edit', $post->id) }}">Edit</a>
                                <a class="btn btn-link" href="#" onclick="event.preventDefault(); document.getElementById('destroy-post-{{ $post->id }}').submit();">Delete</a>
                                <form id="destroy-post-{{ $post->id }}" action="{{ route('posts.destroy', $post->id) }}" method="POST" style="display: none;">
                                    {{ csrf_field() }}
                                    <input name="_method" type="hidden" value="DELETE">
                                </form>
                            </td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@endsection
@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
                    <li class="breadcrumb-item"><a href="{{ route('posts.index') }}">Posts</a></li>
                    <li class="breadcrumb-item active" aria-current="page">{{ $post->title }}</li>
                </ol>
            </nav>

            <div class="card">
                <div class="card-header">Post Details</div>
                <div class="card-body">
                    <div class="form-group row">
                        <label for="name" class="col-md-4 col-form-label text-md-right">Name:</label>
                        <div class="col-md-6">
                            <input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ $category->name }}" readonly>

                            @error('name')
                                <span class="invalid-feedback" role="alert">
                                    <strong>{{ $message }}</strong>
                                </span>
                            @enderror
                        </div>
                    </div>

                    <div class="form-group row">
                        <label for="description" class="col-md-4 col-form-label text-md-right">Description:</label>
                        <div class="col-md-6">
                            <input id="description" type="text" class="form-control @error('description') is-invalid @enderror" name="description" value="{{ $category->description }}" readonly>

                            @error('description')
                                <span class="invalid-feedback" role="alert">
                                    <strong>{{ $message }}</strong>
                                </span>
                            @enderror
                        </div>
                    </div>

                    <div class="form-group row mb-0">
                        <div class="col-md-8 offset-md-4">
                            <a class="btn btn-link" href="{{ route('categories.index') }}">Back</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

Pastikan Anda menyimpan file view menggunakan ekstensi blade.php. Contoh file create disimpan menjadi create.blade.php.

Kesimpulan

Sampai tahap ini, kita sudah membuat proyek blog sederhana yang akan dijadikan sebagai bahan/modul untuk mengimplementasikan peran dan hak akses pengguna. Hal ini tentu saja bukan akhir dari materi Peran dan Hak Akses di Laravel, mungkin masih ada beberapa sesi lagi untuk masuk ke materi pembatasan hak akses.

Baca Juga:  Membangun REST API Dengan Otentikasi Laravel Passport