I'm new to the Laravel framework, so I'm following this tutorial, cloning instagram. After designing the front end, all was going well, until I started working with php artisan
. I have created the user and profile database, migrated them successfully, and linked them in a one-to-one relationship.
But, after this, trying to login, and navigate to home, I'm getting a
404, not found error
I can't seem to figure out what's wrong.
profileController:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class profilesController extends Controller
{
public function index($user)
{
$user = \App\User::find($user);
return view('home', [
'user' => $user,
]);
}
}
homeController:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
}
web.php:
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::get('/profile/{user}', 'profilesController@index')->name('profile.show');
profile created via php artisan
$profile->user
=> App\User {#2975
id: "1",
name: "Sofolahan Eniola Ademola",
email: "princeademola85@gmail.com",
username: "usertesst",
email_verified_at: null,
created_at: "2019-07-27 16:01:45",
updated_at: "2019-07-27 16:01:45",
}
>>> $profile
=> App\profile {#2965
title: "cool stuff",
description: "desc stuff",
user_id: 1,
updated_at: "2019-07-27 16:04:45",
created_at: "2019-07-27 16:04:45",
id: 1,
user: App\User {#2975
id: "1",
name: "Sofolahan Eniola Ademola",
email: "princeademola85@gmail.com",
username: "usertesst",
email_verified_at: null,
created_at: "2019-07-27 16:01:45",
updated_at: "2019-07-27 16:01:45",
},
}
Am I missing something?