split into modules

This commit is contained in:
Benjamin Takats
2022-12-12 16:21:10 +01:00
parent 40bc58eea2
commit 931b28907d
35 changed files with 259 additions and 309 deletions

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Http\Livewire\BookCase;
use App\Models\BookCase;
use Livewire\Component;
use Livewire\WithFileUploads;
class CommentBookCase extends Component
{
use WithFileUploads;
public $photo;
public string $c = 'de';
public BookCase $bookCase;
public function render()
{
return view('livewire.book-case.comment-book-case');
}
public function save()
{
$this->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://');
}
}
}