-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProductController.php
67 lines (61 loc) · 2.12 KB
/
ProductController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use App\Http\Module\product;
use Input;
use Session;
use Redirect;
use View;
class ProductController extends Controller
{
public static function getProduct()
{
return product::where("display","=",1)->where("bin","=",0)->get();
}
public static function getProductWhereID($id)
{
$product = new product();
return $product->where('id','=',$id)->get();
}
public static function getProductWhereStatus($status)
{
return product::where("display","=",1)->where("bin","=",0)->where('status','=',$status)->get();
}
public static function getProductWhereCategoryID($categoryID,$id)
{
return product::where("display","=",1)->where("bin","=",0)->where('categoryID','=',$categoryID)->where('id','!=',$id)->take(10)->get();
}
public static function getAllProductWhereCategoryID($categoryID)
{
return product::where("display","=",1)->where("bin","=",0)->where('categoryID','=',$categoryID)->paginate(16);
}
public static function getAllProductWhereTagID($ID)
{
return product::where("display","=",1)->where("bin","=",0)->where('TagID','=',$ID)->paginate(16);
}
public static function getAllProductWhereMenuID($ID)
{
return product::where("display","=",1)->where("bin","=",0)->where('menuID','=',$ID)->paginate(16);
}
public static function update($data,$id)
{
$product =new product();
return $product->updateProduct($data,$id);
}
public static function getProductWhereName($name)
{
return product::where("display","=",1)->where("bin","=",0)->where("name","like","%".$name."%")->paginate(16);
}
public static function getProductWhereNameAndCate($name,$categoryID)
{
return product::where("display","=",1)->where("bin","=",0)->where("categoryID","=",$categoryID)->where("name","like","%".$name."%")->paginate(16);
}
public static function getproductMaxView()
{
return product::where("display","=",1)->where("bin","=",0)->orderBy('view','desc')->take(5)->get();
}
}
?>