https://github.com/abolfazlrastegar/laravel-discount
create code discount for project laravel
https://github.com/abolfazlrastegar/laravel-discount
code-discount discount laravel
Last synced: about 1 month ago
JSON representation
create code discount for project laravel
- Host: GitHub
- URL: https://github.com/abolfazlrastegar/laravel-discount
- Owner: abolfazlrastegar
- License: mit
- Created: 2022-05-21T18:34:27.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-04T22:16:51.000Z (over 2 years ago)
- Last Synced: 2025-03-24T15:11:21.704Z (about 2 months ago)
- Topics: code-discount, discount, laravel
- Language: Blade
- Homepage:
- Size: 749 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#Laravel discount package
You can use this to create a discount code and it displays the discount code and deactivates editing and uses bootstrap for the template

### Install package for laravel 7+
```bash
composer require abolfazlrastegar/laravel-discount
````### Publish provider and run migrations
```bash
php artisan vendor:publish --provider="Abolfazlrastegar\LaravelDiscount\Provider\DiscountServiceProvider" --force
php artisan migrate
```### Call component view
```bash
```
### Call js and css
```bash
@stack('head') // copy paste at tag head layout html@stack('footer') // copy paste at last page layout html
```
### Config
```bash
/*
|------------------------------------------------------
| paginate limit for query page
|-------------------------------------------------------
*/
"paginate" => "40",
"limit" => "30",/*
|------------------------------------------------------
| layouts html
|-------------------------------------------------------
*/
"layouts" => 'welcome',/*
|------------------------------------------------------
| prefix in database
|-------------------------------------------------------
*/
"prefix_database" => '',/*
|------------------------------------------------------
| namespace model
|-------------------------------------------------------
*/
"namespace_model_user" => \App\Models\User::class,/*
|------------------------------------------------------
| group route
|-------------------------------------------------------
*/
"middleware" => ['web'],
"prefix" => 'admin',/*
|------------------------------------------------------
| assets
|-------------------------------------------------------
| show file css and js if used from this file => false
*/
"file" => [
"display" => [
"bootstrap-css" => true,
"bootstrap-js" => true,
"persianDatepicker-default" => true,
"persianDatepicker-dark" => true,
"jquery" => true,
"ajax" => true,
"sweetalert2" => true,
"persianDatepicker-js" => true,
]
]
```
### Usage
```bash
DiscountController::create(Request $request); // Create one code discountDiscountController::edit(Request $request); // edit one code discount
DiscountController::getDiscount(); // Show all discount created
DiscountController::historyDiscount(8, Auth::id(), 'wallet'); // Save report used discount codes
DiscountController::validationDiscount('code', Auth::id()) // Validation discount code used user
DiscountController::getDiscountUsedUser(Auth::id()); // Show discount codes one user used
DiscountController::getUserOneDiscount(8); // Show users one code discount used
DiscountController::removeDiscount(8); // Delete one discount created
DiscountController::statusDiscount(8); // Switching status one code discount
```### result function DiscountController::validationDiscount('code', Auth::id())
```bash
//validation ok
{
"id": 2,
"price": 200000,
"percent": 50
}// user used code discount
{
"user": true
}// Expired period of use
{
"date": false
}
```