���Root Mod By V1rus_Alfa
User / IP
:
216.73.217.78
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
repositories
/
dasterang-api
/
modules
/
Blog
/
Http
/
Controllers
/
Api
/
Viewing: BlogController.php
<?php namespace Modules\Blog\Http\Controllers\Api; use App\Http\Controllers\Controller; use Validator; use Modules\Blog\Models\Article; use Modules\Blog\Models\ArticleCategory; use OpenApi\Annotations\OpenApi as OA; class BlogController extends Controller { /** * @OA\Tag( * tags={"Blog"}, * description="opreations related to Blog" * ) */ /** * @OA\Get( * path="/api/blogs/{category_id?}", * operationId="getBlog", * tags={"Blog"}, * summary="get blog detail by category id", * description="get blog detail by category id and the category_id can be null", * @OA\Parameter( * description="category id", * name = "category_id", * in="path", * required=false, * @OA\Schema( * type="integer", * format="int64" * ) * ), * * @OA\Response( * response=200, * description="Its Ok", * @OA\JsonContent() * ), * * ) */ public function GetBlog($category_id = null) { $model = Article::getBlog($category_id); return [ 'code' => 200, 'status' => 'success', 'response' => $model ]; } /** * @OA\Get( * path="/api/blogs/{id}/details", * operationId = "blogDetail", * tags = {"Blog"}, * summary = "get blog detail by id", * description = "get blog detail by id", * @OA\Parameter( * in = "path", * name="id", * required = true, * @OA\Schema( * type = "integer", * format ="int64" * ) * ), * @OA\Response( * response="200", * description = "success", * @OA\JsonContent() * ), * @OA\Response( * response = "404", * description = "error", * @OA\JsonContent() * ) * * ) */ public function GetBlogDetail($id) { $model = Article::getBlogDetail($id); if ($model) { return [ 'code' => 200, 'status' => 'success', 'response' => $model ]; } else { return [ 'code' => 404, 'status' => 'error', 'response' => null ]; } } /** * @OA\Get( * path = "/api/categories/blog/all", * operationId = "getBlogCategories", * tags = {"Blog"}, * summary = "get categories of blog", * description = "get all of categories for blogs", * @OA\Response( * response=200, * description="Success", * @OA\JsonContent() * ) * ) * @return array{code: int, response: \Illuminate\Database\Eloquent\Collection<int, TModel>, status: string} */ public function GetBlogCategory() { $model = ArticleCategory::select('id', 'title')->get(); return [ 'code' => 200, 'status' => 'success', 'response' => $model ]; } }
Coded With 💗 by
0x6ick Mod By V1rus_Alfa