mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2025-12-14 06:36:46 +00:00
✨ feat(news): order notifications by creation date in news index and on create/delete actions
This commit is contained in:
@@ -22,7 +22,9 @@ usesFileUploads();
|
|||||||
state([
|
state([
|
||||||
'file',
|
'file',
|
||||||
'news' => fn()
|
'news' => fn()
|
||||||
=> \App\Models\Notification::query()->get(),
|
=> \App\Models\Notification::query()
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->get(),
|
||||||
'isAllowed' => false,
|
'isAllowed' => false,
|
||||||
'canEdit' => false,
|
'canEdit' => false,
|
||||||
'currentPubkey' => null,
|
'currentPubkey' => null,
|
||||||
@@ -55,7 +57,9 @@ $save = function () {
|
|||||||
'file' => 'required|file|mimes:pdf|max:1024',
|
'file' => 'required|file|mimes:pdf|max:1024',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$notification = \App\Models\Notification::query()->create([
|
$notification = \App\Models\Notification::query()
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->create([
|
||||||
'einundzwanzig_pleb_id' => $this->currentPleb->id,
|
'einundzwanzig_pleb_id' => $this->currentPleb->id,
|
||||||
'category' => $this->form->category,
|
'category' => $this->form->category,
|
||||||
'name' => $this->form->name,
|
'name' => $this->form->name,
|
||||||
@@ -69,7 +73,9 @@ $save = function () {
|
|||||||
$this->form->reset();
|
$this->form->reset();
|
||||||
$this->file = null;
|
$this->file = null;
|
||||||
|
|
||||||
$this->news = \App\Models\Notification::query()->get();
|
$this->news = \App\Models\Notification::query()
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->get();
|
||||||
};
|
};
|
||||||
|
|
||||||
$delete = function($id) {
|
$delete = function($id) {
|
||||||
@@ -88,7 +94,9 @@ $delete = function($id) {
|
|||||||
$deleteNow = function($id) {
|
$deleteNow = function($id) {
|
||||||
$notification = \App\Models\Notification::query()->find($id);
|
$notification = \App\Models\Notification::query()->find($id);
|
||||||
$notification->delete();
|
$notification->delete();
|
||||||
$this->news = \App\Models\Notification::query()->get();
|
$this->news = \App\Models\Notification::query()
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->get();
|
||||||
};
|
};
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user