validate([ 'photo' => 'image|max:4096', // 4MB Max ]); $this->bookCase ->addMedia($this->photo) ->toMediaCollection('images'); return to_route('bookCases.comment.bookcase', ['bookCase' => $this->bookCase->id]); } protected function url_to_absolute($url) { if (str($url)->contains('http')) { return $url; } if (!str($url)->contains('http')) { return str($url)->prepend('https://'); } } }