Php 由于某种原因,Laravel 5 ProfileController重定向到主页

Php 由于某种原因,Laravel 5 ProfileController重定向到主页,php,routing,laravel-5,http-status-code-302,Php,Routing,Laravel 5,Http Status Code 302,因此,我试图访问myproject/public/profile上的页面集,该页面集在my routes.php中定义: Route::get('profile','ProfileController@profile'); (单词“profile”没有其他路由,甚至没有包含profile的路由) My profile.blade.php: @extends('app') @section('scripts') @endsection @section('content') <div cl

因此,我试图访问myproject/public/profile上的页面集,该页面集在my routes.php中定义:

Route::get('profile','ProfileController@profile');
(单词“profile”没有其他路由,甚至没有包含profile的路由)

My profile.blade.php:

@extends('app')
@section('scripts')
@endsection
@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-10 col-md-offset-1">
            <div class="panel panel-default">
                            <?php 
                                 $userid = Input::get('id');
                                 $user = DB::table('users')->where('id',intval($eventid))->first();
                                 $userprofile = DB::table('user_details')->where('user_id',$userid)->first();
                                 ?>
                            <div class="panel-heading"><?php                                    
                                 echo '<b> Profile of ' . $user->first_name . ' ' . $user->last_name . '</b></br>';
                            ?></div>

                            <input class="floatright" type="button" name="addimage" id="addimage" value="Add pictures"/>

            </div>
        </div>
    </div>
</div>
@endsection
@extends('app')
@节(“脚本”)
@端部
@节(“内容”)
@端部
我的个人资料控制器:

<?php namespace App\Http\Controllers;

class ProfileController extends Controller {

/**
 * Create a new controller instance.
 *
 * @return void
 */
public function __construct()
{
    $this->middleware('guest');
}

    public function getprofile(){
        $userid = Input::get('userid');
        if($userid){
            return view('errors/404');
        }
        $user = DB::table('users').where('id',$userid);
        if(!$user){
            return view('errors/404');
        }

        return view('profile');
    }

此页面仅适用于登录用户吗?
然后使用

$this->middleware('auth');

请在控制器顶部包含所有代码、名称空间定义和任何其他
use
定义。此外,在视图中使用任何类似的PHP代码也是非常糟糕的做法。这些都应该在控制器中,变量
$user
$userprofile
作为参数传递。还有,为什么在刀片模板中使用PHP标记而不是刀片标记?老实说,我被迫在很短的时间内使用laravel框架并编写代码,所以我只是将我所知道的与laravel框架的某些部分结合使用,我添加了名称空间声明,顺便说一句,我的所有其他控制器都一样,页面刚刚创建,所以还没有使用语句