class Index extends Controller
{
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
return View('index');
}
class Index extends Controller
{
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$models = MyModel::all();
return View('index', compact('models'));
}
}
// инъекция в конструктор
public function __construct(User $users) {
$this->users = $users;
}
public function index() {
return $this->user->all();
}
// инъекция прямо в метод
public function index(User $users) {
return $users->all();
}