abolfazlrastegar / laravel-discount
library code discount for Laravel Framework.
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 1
Language:Blade
Requires
- php: >=7.0
- morilog/jalali: 3.*
This package is auto-updated.
Last update: 2024-11-05 02:08:01 UTC
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+
composer require abolfazlrastegar/laravel-discount
Publish provider and run migrations
php artisan vendor:publish --provider="Abolfazlrastegar\LaravelDiscount\Provider\DiscountServiceProvider" --force
php artisan migrate
Call component view
<x-Discount-create-discount></x-discount-create-discount>
Call js and css
@stack('head') // copy paste at tag head layout html @stack('footer') // copy paste at last page layout html
Config
/* |------------------------------------------------------ | 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
DiscountController::create(Request $request); // Create one code discount DiscountController::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())
//validation ok { "id": 2, "price": 200000, "percent": 50 } // user used code discount { "user": true } // Expired period of use { "date": false }