Answer the question
In order to leave comments, you need to log in
How to implement an individual page for each user in Laravel?
Please tell me how to implement using a simple example of a task book, so that after registration and authorization, for each authorized user there would be individual tasks. Ivan (his notes) Vasily (his notes). I will be very grateful. CRUD implemented, but I would like to make adjustments to the project)
Answer the question
In order to leave comments, you need to log in
If you don’t delve into the relationship yet, then there is the simplest way:
1) Create a user_id column in the tasks table. It is desirable to connect it with users, but at the initial stages it is better not to bother with such trifles)) Anyway, then 10 times then redo everything, demolish tables, rename everything, rewrite, etc.
2) When you create a task write to user_id =Auth::id(); .
$task=new Task;
$task->user_id = Auth::id();
$task->save();
$tasks=Task::where('user_id',Auth::id())
->get();
$tasks=Task::where('user_id',Auth::id());
$count = $tasks->count();
$tasks=$tasks->orderBy('updated_at', 'desc')
->paginate(20);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question