Page 10 - Modul CRUD Laravel_Neat
P. 10
<td>
<a class="btn btn-primary" href="/barang/edit/{{ $b-
>id }}" role="button">Edit</a>
<a class="btn btn-danger" href="/barang/delete/{{ $b-
>id }}" role="button">Hapus</a>
</td>
</tr>
@endforeach
</table>
</div>
</div>
</div>
</body>
</html>
16. Kemudian buat controller untuk barang.
Kemudian isikan kode berikut:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class BarangController extends Controller
{
public function index(Request $request)
{
$data = DB::table('barang')->get();