Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gheorghelupu17 committed Oct 24, 2023
1 parent 804e43b commit 67a951a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
8 changes: 5 additions & 3 deletions app/Http/Controllers/ArticleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public function index(Request $request): Response
->wherePublished()
->inRandomOrder()
->limit(3)
->get())
->get()
),
]);
}

Expand All @@ -50,15 +51,16 @@ public function category(ArticleCategory $category, Request $request): Response
->wherePublished()
->inRandomOrder()
->limit(3)
->get())
->get()
),
]);
}

public function show(Article $article): Response
{
return Inertia::render('Public/Articles/Show', [
'resource' => ArticleResource::make($article),
'related' => ArticleCardResource::collection(Article::query()
'related' => ArticleCardResource::collection(Article::query()
->wherePublished()
->whereBelongsTo($article->category, 'category')
->whereNot('id', $article->id)
Expand Down
9 changes: 0 additions & 9 deletions app/Http/Controllers/BcrProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,11 @@

namespace App\Http\Controllers;

use App\Http\Filters\AcceptsVolunteersFilter;
use App\Http\Filters\BcrProjectDatesFilter;
use App\Http\Filters\CountiesFilter;
use App\Http\Filters\ProjectCategoriesFilter;
use App\Http\Filters\ProjectDatesFilter;
use App\Http\Filters\ProjectStatusFilter;
use App\Http\Filters\SearchFilter;
use App\Http\Resources\BCRProjectCardResource;
use App\Http\Resources\BcrProjectResource;
use App\Http\Resources\Collections\BcrProjectCardCollection;
use App\Http\Sorts\ProjectDonationsCountSort;
use App\Http\Sorts\ProjectDonationsSumSort;
use App\Models\BCRProject;
use App\Models\Project;
use Inertia\Inertia;
use Spatie\QueryBuilder\AllowedFilter;
use Spatie\QueryBuilder\AllowedSort;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Resources/Articles/ArticleCardResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function toArray(Request $request): array
->limit(200),
'author' => $this->author,
'category' => $this->category?->only('name', 'slug'),
'cover' => $this->getFirstMediaUrl('cover', 'large'),
'cover' => $this->getFirstMediaUrl('preview', 'large'),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace App\Http\Resources\Collections;

use App\Http\Resources\BCRProjectCardResource;
use App\Http\Resources\ProjectCardResource;

class BcrProjectCardCollection extends ResourceCollection
{
Expand Down

0 comments on commit 67a951a

Please sign in to comment.