when trying to extract some values from the database using the model object, the user receives the following error: BadMethodCallException Method [find] does not exist
Here are my files: Model user
<?php
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
class User extends Eloquent implements UserInterface, RemindableInterface {
protected $table = 'users';
protected $hidden = array('password');
public function projects()
{
return $this->belongsToMany('Project');
}
public function trys()
{
return $this->hasMany('Try');
}
public function getAuthIdentifier()
{
return $this->getKey();
}
public function getAuthPassword()
{
return $this->password;
}
public function getReminderEmail()
{
return $this->email;
}
}
Controller User:
<?php
class user extends BaseController {
public function showWelcome($id)
{
$user1 = User::find($id);
return View::make('users.index', array('user' => $user1));
}
}
View Users /index.php
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>first page</title>
</head>
<body>
<?php echo 'Hello'; ?>
</body>
</html>
and route.php:
<?php
Route::get('user/{id}', 'user@showWelcome');
Route::get('/', function()
{
return View::make('hello');
});
thanks for the help
source
share