help

->afterStateHydrated(function (Component $component) { $postModel = new PostMedia(); $postId = $component->getModel(); // dump($postId); // $post = $postModel->find($postId); // $images = $post->getPosts(); // return $component->state([ // 'content_url' => $images, // ]); }) i have this method and i have to get the corrent post id on view . how do i get
2 Replies
toeknee
toeknee4mo ago
->afterStateHydrated(function (Component $component, PostMedia $record) { $postModel = new PostMedia(); $postId = $component->getModel(); // dump($postId); // $post = $postModel->find($postId); // $images = $post->getPosts(); // return $component->state([ // 'content_url' => $images, // ]); }) i have this method and i have to get the corrent post id on view . how do i get Then use $record->id if I understand you correctly.