This is a Laravel project using PHP 8+. The project includes the following key libraries:
- Filament Shield for Role-Based Access Control (RBAC).
- Rupadana API Service for creating and managing API services.
Follow these steps to install and set up the project:
- PHP 8.0 or higher
- Composer
- MySQL or another supported database
- Node.js and npm (optional, if you need to compile assets)
-
Clone the repository:
git clone https://github.com/mohammadisa2/blog.git cd blog -
Install dependencies:
composer install npm install && npm run dev # If you need to compile assets
-
Environment setup: Copy the
.env.exampleto.envand adjust your environment variables, includingAPP_URL,DB_*, and other necessary configurations.cp .env.example .env
-
Generate application key:
php artisan key:generate
-
Run migrations:
php artisan migrate
-
Run seeder (if applicable):
php artisan db:seed
-
Serve the application:
php artisan serve
-
Install Filament Shield (for RBAC): You can follow the Filament Shield documentation here to set up roles and permissions.
-
Set up Rupadana API Service (for API): The Rupadana API Service documentation can be found here.
This endpoint retrieves blogs, including their category relation, and allows filtering based on the category.slug.
Endpoint:
GET {{APP_URL}}/api/admin/blogs?include=category&filter[category.slug]=computer- Parameters:
include=category– Includes the category relation.filter[category.slug]=<slug>– Filters the blogs by the slug of the category.
To sort blogs by id in descending order:
Endpoint:
GET {{APP_URL}}/api/admin/blogs?sort=-id- Parameters:
sort=-id– Sorts the blogs by ID in descending order.
This endpoint fetches a specific blog by its slug, including its category relation.
Endpoint:
GET {{APP_URL}}/api/admin/blogs/ex-qui-soluta-archit?include=category- Parameters:
include=category– Includes the category relation in the response.
This endpoint retrieves all available categories. No additional parameters are required since no relations are involved.
Endpoint:
GET {{APP_URL}}/api/admin//category-blogsThis documentation provides basic API interaction for the blog and category entities. Ensure you set the correct APP_URL in your .env file to correspond to your environment.