guys! I have got some problems. I have User and Page is kinda info about the user like Profile. I have created User(using php artisan ui bootstrap --auth) and PageController and Page (controller, model php artisan make:model and controller)
I have linked them using relations with one-to-one What is my problem?
<?php
namespace App\Http\Controllers;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
//use Illuminate\Support\Facades\Auth;
class PageController extends Controller
{
//
public function index(User $user)
{
dd($user);
// $user = \App\User::findOrFail($user);
// dd($user->page()->title());
// dd($user_id);
// dd(User::find($user_id));
// $user = User::findOrFail($user_id);
return view('pages.index', compact('user'));
}
}
I don't get $user->page values using public function index(User $user)
What am I doing wrong?
But when I do use :
$user = \App\User::findOrFail($user);