Home Undefined variable: users (View: C:\xampp\htdocs\rentalmobil\resources\views\admin\user.blade.php)
Reply: 0

Undefined variable: users (View: C:\xampp\htdocs\rentalmobil\resources\views\admin\user.blade.php)

user2317 Published in May 24, 2018, 4:00 pm


i am confusing that i think i have already make a true code with laravel. i have seen on many references for me to know how to read database. yes i'm newbie and still learning. well here is my code

from model. admin.php is the name of folder:


namespace App;

use Illuminate\Database\Eloquent\Model;

class Admin extends Model
    protected $table = "admin";

here is my controller. my controller name is UserController.php


namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Admin;

class UserController extends Controller
    public function users(){
        $users = Admin::all();
        return view('admin.user', ['admin' => $users]);


and here is my view, it is located in view/admin/ named user.blade.php:


<div class="col-md-12">
    <div class="card">
        <div class="header">
            <h4 class="title">Striped Table</h4>
            <p class="category">Here is a subtitle for this table</p>
        <div class="content table-responsive table-full-width">
            <table class="table table-striped">
                        <td>{{ $users->email }}</td>


and here is my error

i call from my browser with this http://localhost:8000/users

sorry for bad English :(

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.374018 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO