LetMeKnow
1 month ago
232
12
Laravel

Return View dost'nt work

Posted 1 month ago by LetMeKnow

When im acces localhost:8000/tag/1 , he saw blank page without error , i mean , when im click button Edit, my web show to me a Form edit, but there is currently no display.

I have a table like this in index.blade.php

<table class="table table-report sm:mt-2">
            <thead>
                <tr>
                    <th class="text-center whitespace-no-wrap">No.</th>
                    <th class="text-center whitespace-no-wrap">Kategori</th>
                    <th class="text-center whitespace-no-wrap">Aksi</th>
                </tr>
            </thead>
            @foreach ($tag as $result => $hasil )
            <tbody>
                <tr>
                <td class="text-center">{{ $result + $tag->firstitem() }}</td>
                <td class="text-center">{{ $hasil->name }}</td>
                <td class="text-center">
                            <div class="flex justify-center items-center">
                                <a class="flex items-center mr-3" href="{{ route('tag.update', $hasil->id ) }}"> <i data-feather="check-square" class="w-4 h-4 mr-1"></i> Ubah </a>
                                <form action="{{ route('tag.destroy', $hasil->id) }}" method="POST">
                                    @csrf
                                    @method('delete')
                                <button type="submit" class="flex items-center text-theme-6"> <i data-feather="trash-2" class="w-4 h-4 mr-1"></i> Hapus </button>
                            </div>
                         </form>
                        </td>
                    
                </tr>
                @endforeach
            </tbody>
        </table>

and my edit.blade.php

@extends('template_admin.home')


@section('judul', 'Edit - Tag Berita')
@section('content')

@if(count($errors)>0)
@foreach ($errors-> all(); as $error)
<br>
<div class="rounded-md flex items-center px-5 py-4 mb-2 bg-theme-6 text-white"> <i data-feather="alert-octagon" class="w-6 h-6 mr-2"></i> {{ $error }} <i data-feather="x" class="w-4 h-4 ml-auto"></i> </div>
@endforeach
@endif


<br>
<div> <label>Tag</label> <input type="text" class="input w-full border mt-2" placeholder="Ketikkan Tag" name="name" value="{{ $tags->name }}"> </div><br><br>
<button class="button w-32 mr-2 mb-2 flex items-center justify-center bg-theme-1 text-white"> <i data-feather="plus-circle" class="w-4 h-4 mr-2"></i> Edit Data </button>
@endsection

in my controllers TagsController.php

   public function edit($id)
    {
        $tags = Tags::findorfail($id);
        return view('adminsuper.tag.edit', compact('tags'));
    }

when im clieck "Edit" my localhost display a blank page.

Please sign in or create an account to participate in this conversation.