Meine Route:
Route::get('/user/{username}', [ 'uses' => '\MostWanted\Http\Controllers\[email protected]', 'as' => 'profile.index', ]);
NotFoundHttpException in RouteCollection.php Linie 161 in Laravel 5.2
Mein Controller:
namespace MostWanted\Http\Controllers;
use MostWanted\Models\User;
use Illuminate\Http\Request;
class ProfileController extends Controller
{
public function getProfile($username)
{
$user = User::where('username', $username)->first();
if (!$user) {
abort(404);
}
return view('profile.index');
}
}
Was es sieht:
@extends('templates.default')
@section('content')
<div class="row">
<div class="col-lg-5">
<!-- User information and statuses -->
</div>
<div class="col-lg-4 col-lg-offset-3">
<!-- Friends, friend requests -->
</div>
</div>
@stop
Ich bin ganz sicher, der Code ist korrekt, aber es hat immer noch diesen Fehler. Wo ist das Problem und wie kann ich es lösen?
Vielen Dank für Ihre Hilfe im Voraus.
Yep ersetzt werden. Benutzername existiert in der Migrationstabelle. Schema :: create ('Benutzer', function ($ Blueprint-Tabelle) {\t \t \t Tabellen- $> Schritten ('id'); \t \t $ table-> string ('username'); \t \t $ table-> string ('last_name'); \t \t $ table-> string ('E-Mail'); \t \t $ table-> string ('password'); \t \t $ table-> string ('first_name ') -> nullable(); \t \t $ tabelle-> string (' location ') -> nullable(); \t \t $ tabelle-> string ('remember_token') -> nullable(); \t \t $ Tabelle-> Zeitstempel(); \t \t}); } – maftyycs
Nein, nehme URL wie folgt an:/user/admin => hat username *** admin *** existiert bereits in der Datenbank? – trinvh
Nein. Wahrscheinlich nicht. Ich verwende derzeit Windows 10. Gibt es eine Möglichkeit, wie ich auf die Datenbank zugreifen kann? Wenn das so ist, wie? – maftyycs