authentication - 将数组从 AuthController 传递到 Laravel 5 中的登录 View

标签 authentication laravel controller

我在将数组从 Laravel 的 AuthController 传递到 auth.login View 时遇到问题。我想做的是从新闻模型中检索数据并将其发送到 View 。我知道如何使用 Eloquent 检索数据,从 Controller 传递到 View 是我的问题,因为我看不到 Laravel 渲染 View 的方式/位置。

最佳答案

在 Controller 中返回时,将数组作为第二个参数添加到 View 方法。

return view('greetings', ['name' => 'Victoria']); // in controller

然后在您看来,您应该能够访问变量 $name,它应该等于 Victoria

var_dump($name); // in view

More in the documentation

关于authentication - 将数组从 AuthController 传递到 Laravel 5 中的登录 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31036935/

相关文章:

javascript - AngularJS - 接收动态内容的组件

json - 如何将 json 文件加载到 Laravel Controller 中?

ASP.NET 成员(member)身份 以用户身份登录

authentication - Polymer 1.0 : User authentication UX (recommendations, 教程和示例)?

linux - 设置 SFTP 以使用公钥身份验证

php - Laravel Eloquent 查询

php - Symfony2 Controller 、 View 和 JavaScript

android - 尝试从具有沙箱环境的 android sdk 示例登录 paypal 帐户时登录失败

php - 用多个select语句查询并加入Eloquent

php - 如何保存多个表单?