REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.62 KB
Close
/home/byroehnu/easetack.com/app/Repositories/Frontend/BlogRepository.php
Text
Base64
<?php namespace App\Repositories\Frontend; use App\Models\Comment; use App\Models\Post; use Illuminate\Http\Request; class BlogRepository { protected Post $model; public function __construct(Post $post) { $this->model = $post; } public function paginateSearchResult($search, array $filter = []) { $query = $this->model->with([ 'content', 'category.content', 'user', ])->withCount('comments')->newQuery(); if (! empty($search)) { $query->whereHas('contents', function ($q) use ($search) { $q->where('title', 'like', "%{$search}%") ->orWhere('title', 'like', "%{$search}%"); })->orWhereHas('category.contents', function ($q) use ($search) { $q->where('title', 'like', "%{$search}%"); })->orWhereHas('tags', function ($q) use ($search) { $q->where('name', 'like', "%{$search}%"); }); } if (! empty($filter['category'])) { $query->whereHas('category.content', function ($q) use ($filter) { $q->where('title', $filter['category']); }); } if (! empty($filter['tag'])) { $query->withAnyTags([$filter['tag']]); } if (! empty($filter['author'])) { $query->whereHas('user', function ($q) use ($filter) { $q->where('id', $filter['author']); }); } return $query->where('status', '1')->paginate(6); } /** * Show blog post */ public function show($slug): mixed { $post = $this->model->with(['content', 'category.content', 'comments', 'user'])->where('slug', $slug)->withCount('comments')->first(); if (! $post) { abort(404); } return $post; } /** * Post comment store */ public function storeComment(Request $request): void { Comment::create([ 'post_id' => $request->post_id, 'comment_parent' => $request->comment_parent, 'comment_content' => $request->comment, 'comment_author_website' => $request->website, 'comment_author_email' => $request->email, 'comment_author_name' => $request->full_name, ]); } /** * Get published blog * * @return mixed */ public function getPublishedBlogs() { return $this->model->where('status', '1') ->with('content', 'user', 'category.content') ->take(10) ->inRandomOrder() ->latest() ->get(); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 9
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
BlogRepository.php
2.62 KB
lrw-rw-rw-
2025-04-19 04:22:15
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CheckoutRepository.php
8.26 KB
lrw-rw-rw-
2025-05-15 11:24:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PageRepository.php
1.45 KB
lrw-rw-rw-
2025-04-19 04:22:15
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PricingPlanRepository.php
6.38 KB
lrw-rw-rw-
2025-05-08 12:05:13
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ProductRepository.php
2.52 KB
lrw-rw-rw-
2025-04-26 11:30:31
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ProfileRepository.php
1.77 KB
lrw-rw-rw-
2025-04-15 10:33:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ReviewRepository.php
829 B
lrw-rw-rw-
2025-04-19 04:22:16
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
SearchRepository.php
5.46 KB
lrw-rw-rw-
2025-04-24 11:21:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TicketRepository.php
3.50 KB
lrw-rw-rw-
2025-04-13 07:02:31
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).