Data detail pada file show.blade.php tidak muncul

Kenapa ya data detail ini tidak muncul : Controller :
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Petugas;
use App\Ruangan;
use App\Jenis;
use App\Inventory;

class inventorysController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        $jenis   = Jenis::all();
        $ruangan = Ruangan::all();
        $petugas = Petugas::all();
        $inventory = Inventory::all();
        return view('inventaris.index',compact('petugas','ruangan','jenis','inventory'));
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
         Inventory::create($request->all());
        return redirect('/inventaris/create')->with('status','Your Data Has Been Stored!');
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show(Inventory $inventory)
    {
        return view('inventaris.show',compact('inventory'));
    }
    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy(Inventory $inventory)
    {
        Inventory::destroy($inventory->id_inventaris);
       return redirect('/inventaris/create')->with('status','Data Berhasil Di hapus');
    }
}
Show.blade.php
@extends('pusat.dashboard')
@section('title','Details')
@section('content')
@if (session('status'))
<div class="alert-success" role="alert">
    {{ session('status') }}
</div>
@endif
<div class="container">
{{-- inventaris  --}}
<h1 align="center" class="">Inventaris</h1>
<div class="bottom">
    <table border="1">
        <thead>
            <tr>
                <td>Nama Barang</td>
                <td>Kode Inventaris</td>
                <td>kondisi Barang</td>
                <td>Keterangan</td>
                <td>Jenis</td>
                <td>Petugas</td>
                <td>Jumlah</td>
                <td>Tanggal Registrasi</td>
                {{-- <td>Action</td>  --}}
            </tr>
        <tbody>
            <tr>
                <td>{{$inventory->nama}}</td>
                <td>{{$inventory->kode_inventaris}}</td>
                <td>{{$inventory->kondisi}}</td>
                <td>{{$inventory->keterangan}}</td>
                <td>{{$inventory->id_jenis}}</td>
                <td>{{$inventory->id_petugas}}</td>
                <td>{{$inventory->jumlah}}</td>
                <td>{{$inventory->tanggal_registrasi}}</td>
                {{-- <td>
                    <a href="/inventaris/{{$i->id_inventaris}}" class="aksi-bos">Detail</a>
                </td> --}}
            </tr>
        </tbody>

    </table>
    @endsection
Routes :
<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Auth::routes();
Route::get('/','LandingsController@index');
Route::get('/dashboard/index','PagesController@index');
// inventaris
Route::get('/inventaris/create','inventorysController@create');
Route::post('/inventaris','inventorysController@store');
// Route::delete('/inventaris/{Inventory}','inventorysController@destroy');
Route::get('/inventaris/{Inventory}','inventorysController@show');
// End inventaris
avatar jiasfjabfie1212

Ditanyakan oleh @jiasfjabfie1212

36 Kontribusi 0 Poin

Login untuk menanggapi


Jawaban Terpilih

public function show($id)
{
    $inventory = Inventory::find($id)->first();
    return view('inventaris.show',compact('inventory'));
}
avatar driyan

Dijawab oleh @driyan

190 Kontribusi 108 Poin

Jawaban

public function show($id)
{
    $inventory = Inventory::find($id)->first();
    return view('inventaris.show',compact('inventory'));
}
avatar driyan

Dijawab oleh @driyan

190 Kontribusi 108 Poin

Login untuk menanggapi


Login untuk gabung berdiskusi