mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
!auth()->check()
This commit is contained in:
@@ -30,10 +30,10 @@ class OrangePillForm extends Component
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'orangePill.book_case_id' => ['required'],
|
'orangePill.book_case_id' => ['required'],
|
||||||
'orangePill.user_id' => ['required'],
|
'orangePill.user_id' => ['required'],
|
||||||
'orangePill.amount' => ['required', 'numeric'],
|
'orangePill.amount' => ['required', 'numeric'],
|
||||||
'orangePill.date' => ['required', 'date'],
|
'orangePill.date' => ['required', 'date'],
|
||||||
'orangePill.comment' => ['required', 'string'],
|
'orangePill.comment' => ['required', 'string'],
|
||||||
|
|
||||||
'image' => ['max:8192', Rule::requiredIf(!$this->orangePill->id), 'image', 'nullable'], // 8MB Max
|
'image' => ['max:8192', Rule::requiredIf(!$this->orangePill->id), 'image', 'nullable'], // 8MB Max
|
||||||
];
|
];
|
||||||
@@ -41,12 +41,12 @@ class OrangePillForm extends Component
|
|||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
if (! $this->orangePill) {
|
if (!$this->orangePill) {
|
||||||
$this->orangePill = new OrangePill([
|
$this->orangePill = new OrangePill([
|
||||||
'user_id' => auth()->id(),
|
'user_id' => auth()->id(),
|
||||||
'book_case_id' => $this->bookCase->id,
|
'book_case_id' => $this->bookCase->id,
|
||||||
'date' => now(),
|
'date' => now(),
|
||||||
'amount' => 1,
|
'amount' => 1,
|
||||||
]);
|
]);
|
||||||
} elseif ($this->orangePill->user_id !== auth()->id()) {
|
} elseif ($this->orangePill->user_id !== auth()->id()) {
|
||||||
abort(403);
|
abort(403);
|
||||||
@@ -58,6 +58,9 @@ class OrangePillForm extends Component
|
|||||||
|
|
||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
|
if (!auth()->check()) {
|
||||||
|
return to_route('auth.ln');
|
||||||
|
}
|
||||||
$this->validate();
|
$this->validate();
|
||||||
$this->orangePill->save();
|
$this->orangePill->save();
|
||||||
|
|
||||||
@@ -74,7 +77,9 @@ class OrangePillForm extends Component
|
|||||||
public function deleteMe()
|
public function deleteMe()
|
||||||
{
|
{
|
||||||
$this->orangePill->delete();
|
$this->orangePill->delete();
|
||||||
auth()->user()->undoPoint(new BookCaseOrangePilled(auth()->user()));
|
auth()
|
||||||
|
->user()
|
||||||
|
->undoPoint(new BookCaseOrangePilled(auth()->user()));
|
||||||
|
|
||||||
return redirect($this->fromUrl);
|
return redirect($this->fromUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user