Actualizacuion de Rama Kquiroz

This commit is contained in:
ellecio2
2023-09-04 19:53:37 -04:00
parent d2e9ba53ab
commit 2e99d7b290
2206 changed files with 100145 additions and 467275 deletions

View File

@@ -11,6 +11,9 @@ use App\Models\Category;
use App\Models\Product;
use App\Models\ProductTax;
use App\Models\ProductTranslation;
use App\Models\Wishlist;
use App\Models\User;
use App\Notifications\ShopProductNotification;
use Carbon\Carbon;
use Combinations;
use Artisan;
@@ -21,6 +24,7 @@ use App\Services\ProductService;
use App\Services\ProductTaxService;
use App\Services\ProductFlashDealService;
use App\Services\ProductStockService;
use Illuminate\Support\Facades\Notification;
class ProductController extends Controller
{
@@ -55,15 +59,8 @@ class ProductController extends Controller
public function create(Request $request)
{
if (addon_is_activated('seller_subscription')) {
if (seller_package_validity_check()) {
$categories = Category::where('parent_id', 0)
->where('digital', 0)
->with('childrenCategories')
->get();
return view('seller.product.products.create', compact('categories'));
} else {
if (!seller_package_validity_check()) {
flash(translate('Please upgrade your package.'))->warning();
return back();
}
@@ -107,6 +104,11 @@ class ProductController extends Controller
'lang', 'name', 'unit', 'description', 'product_id'
]));
if(get_setting('product_approve_by_admin') == 1){
$users = User::findMany([auth()->user()->id, User::where('user_type', 'admin')->first()->id]);
Notification::send($users, new ShopProductNotification('physical', $product));
}
flash(translate('Product has been inserted successfully'))->success();
Artisan::call('view:clear');
@@ -254,11 +256,7 @@ class ProductController extends Controller
$product->published = $request->status;
if (addon_is_activated('seller_subscription') && $request->status == 1) {
$shop = $product->user->shop;
if (
$shop->package_invalid_at == null
|| Carbon::now()->diffInDays(Carbon::parse($shop->package_invalid_at), false) < 0
|| $shop->product_upload_limit <= $shop->user->products()->where('published', 1)->count()
) {
if (!seller_package_validity_check()) {
return 2;
}
}
@@ -323,6 +321,7 @@ class ProductController extends Controller
if (Product::destroy($id)) {
Cart::where('product_id', $id)->delete();
Wishlist::where('product_id', $id)->delete();
flash(translate('Product has been deleted successfully'))->success();