/
home
/
henzagold
/
server
/
app
/
Http
/
Controllers
/
Adm
/
File Upload :
llllll
Current File: /home/henzagold/server/app/Http/Controllers/Adm/DashboardController.php
<?php namespace App\Http\Controllers\Adm; use App\DB\Te\TableEngine; use App\Http\Controllers\Controller; use App\Models\Category; use App\Models\Collect; use App\Models\Customer; use App\Models\Link; use App\Models\Product; use App\Models\ProductVariant; use Illuminate\Http\Request; class DashboardController extends Controller { public function getAll(){ $product = ProductVariant::whereHas('product',function ($q){ return $q->whereIn('show_type',[1,3])->where('qty','>',1); })->get(); // $p =Product::whereIn('show_type',[2,3])->get(); // foreach ($p as $item){ // $v = ProductVariant::where('product_id_id',$item->id)->count(); // if ($v>1){ // print_r($item->id.' '); // } // } // foreach ($p as $item){ // if ($item->max_gram > $item->min_gram){ // print_r($item->id.' '); // } // } // return response()->json(Product::whereIn('show_type',[2,3])->sum('min_gram')); // return response()->json(Product::whereIn('show_type',[1,3])->where()); return response()->json($product); } public function change(){ $product = Product::with('collect.collection')->where('title','like','%'.'پرتفینو'.'%')->get(); // foreach ($product as $p){ // Category::reloadCategory([28],$p->id); // } // $product = Product::where('title','like','%'.'پرتفینو'.'%')->update(['show_type'=>2]); return response()->json($product); } public function info(){ $c = Collect::where('collection_id_id',42)->select('product_id_id')->get()->pluck('product_id_id')->toArray(); // foreach ($p as $item){ // $s = Product::find($item); // print_r($item.' '); // print_r($s->show_type.' '); // if (is_null($s)){ // print_r($item); // } // } // $p = Product::where('title','like','%'.'گردنبند'.'%')->where('show_type',1)->count(); // $p = Product::with('collect')->where('title','like','%'.'گردنبند'.'%')->where('show_type',2) // ->whereHas('collect',function ($q){ // return $q->where('collection_id_id',29); // })->get(); // $p = Product::where('title','like','%'.'گردنبند'.'%')->whereIn('show_type',[2,3])->select('id')->get()->pluck('id')->toArray(); $p = Product::where('title','like','%'.'گردنبند'.'%')->whereIn('show_type',[2,3])->select('id')->get()->toArray(); // $o = array_diff($c,$p); // $i = 0; $a = []; foreach ($c as $item){ $p = Product::find($item); if ($p->show_type != 2 && $p->show_type != 3){ print_r($p->id.' '); } //// $c = Collect::where('product_id_id',$item->id)->where('collection_id_id',29)->get(); //// $key = array_search(29,$c); //// if (in_array(29,$c)){ //// unset($c[$key]); //// print_r($item->id.' '); //// $i++; //// } // } //// $p = Product::where('title','like','%'.'گردنبند'.'%')->where('show_type',3)->count(); // return $p; } public function link(){ return response()->json(Link::all()); } }
Copyright ©2k19 -
Hexid
|
Tex7ure