登录后会重定向到http://localhost/laravel/public/homeLaravel 5主页控制器
所以查看文件的位置将被\资源\意见\ home.blade.php。
现在这个主页上我可以在使用
D:\wamp\www\laravel>php artisan make:controller HomeController
控制器创建成功获得登录用户ID
<?php
echo $id = Auth::id();
?>
现在我已创建控制器。
现在,在首页我必须显示一些数据的基础上登录用户。
在家庭控制器,如果我做回声退出,但它不工作。那么在哪个控制器文件中我必须编写代码?
HomeController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class HomeController extends Controller
{
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
}
}
显示您的家庭控制器 –
已添加问题。 –
这只是我还是这个问题真的含糊不清?我假设你有你的路线工作,你的中间件设置,你有你的观点返回,但**你只是想从'Auth :: user()** **检索数据? – ash