mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
split into modules
This commit is contained in:
22
app/Http/Livewire/BookCase/BookCaseTable.php
Normal file
22
app/Http/Livewire/BookCase/BookCaseTable.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\BookCase;
|
||||
|
||||
use App\Models\BookCase;
|
||||
use App\Models\Country;
|
||||
use Livewire\Component;
|
||||
|
||||
class BookCaseTable extends Component
|
||||
{
|
||||
public string $c = 'de';
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.book-case.book-case-table', [
|
||||
'bookCases' => BookCase::get(),
|
||||
'countries' => Country::query()
|
||||
->select(['code', 'name'])
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
46
app/Http/Livewire/BookCase/CommentBookCase.php
Normal file
46
app/Http/Livewire/BookCase/CommentBookCase.php
Normal 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://');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user