public function afterCreate() { $newsLink = '/news/' . $this->category . '/item/' . $this->slug; $links = Link::where('link', $newsLink)->get(); foreach ($links as $link) { $link->photo = isset($this->photos[0]) ? $this->photos[0] : null; $link->save(); } }
public function afterCreate() { $articleLink = '/articles/' . $this->slug; $links = Link::where('link', $articleLink)->get(); foreach ($links as $link) { $link->photo = $this->photo; $link->save(); } }