V
V
VladimirKrasnov2020-10-20 09:27:13
Laravel
VladimirKrasnov, 2020-10-20 09:27:13

How to get the full address of a post and add it to the database?

I need that during the publication of the post, in addition to the standard data (title, message, etc.), the full address of this post would also arrive in the database. The problem is that I can't get the post id in any way.

The link to the post I have is 127.0.0.1:8000/id2/post/630 , where id2 is the id of the user who muddied the post and 630 is the id of the post itself.

$post = new Profile();
$post->title = $request->title;
$post->message = $request->message;
$post->fullAdress = 'http://127.0.0.1:8000/'.$post->user_id.'/post/630'.$post->id;
$post->save();

Is there any way to get the id of a post before the post is even created?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question