本文整理汇总了PHP中app\Order::getOrdersUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::getOrdersUser方法的具体用法?PHP Order::getOrdersUser怎么用?PHP Order::getOrdersUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Order
的用法示例。
在下文中一共展示了Order::getOrdersUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
//
$menuOptions = [0 => ["data-letters" => "", "id" => "home", "text" => "Home", "href" => "/"]];
if (Auth::check()) {
$user = Auth::user();
$verifyAdmin = Admin::find($user->id);
if (isset($verifyAdmin->id)) {
$users = User::all();
$fabrics = Fabric::all();
$data = array("latestOrders" => Order::getOrders(0), "latestUsers" => User::where("confirmed", "=", "0")->orderBy("created_at", "")->take(5)->get(), "user" => $user, "users" => $users, "fabrics" => $fabrics, "orders" => Order::getOrders(0), "confirmed-users" => User::where("confirmed", "=", "1")->orderBy("created_at", "")->take(5)->get(), "admin" => true);
/*Session::put('paginate', [
"confirmed-users" => 5,
"not-confirmed-users" => 5,
"not-confirmed-orders" => 5,
"confirmed-orders" => 5
]);*/
return view("panel.admin-panel")->with("data", $data)->with("user", $user);
} else {
$stats = ["orders" => Order::where("user_id", "=", $user->id)->count(), "unconfirmed" => Order::where("user_id", "=", $user->id)->where("status", "=", "not-confirmed")->count(), "confirmed" => Order::where("user_id", "=", $user->id)->where("status", "=", "confirmed")->count(), "latest" => Order::where("user_id", "=", $user->id)->max("created_at")];
//dd(Order::getOrdersUser($user->id));
$data = array("orders" => Order::getOrdersUser($user->id, 0), "stats" => $stats, "fabrics" => Fabric::all(), "admin" => false);
/*Session::put('paginate', [
"confirmed-orders" => 5,
"not-confirmed-orders" => 5,
]);*/
return view("panel.normal-panel")->with("user", $user)->with("data", $data);
}
} else {
return redirect("/")->with("menuOptions", $menuOptions);
}
}
示例2: getPaginate
public function getPaginate(Request $request)
{
if (Auth::check()) {
$skip = $request->input("skip");
$type = $request->input("type") != null ? $request->input("type") : "null";
if ($type == "all" && User::isAdmin(Auth::user())) {
$orders = Order::getOrders($skip);
return ["result" => true, "msg" => "Orders found", "orders" => $orders];
} else {
$orders = Order::getOrdersUser(Auth::user()->user_id, $skip);
return ["result" => true, "msg" => "success", "orders" => $orders];
}
} else {
return ["result" => false, "msg" => "Session not found"];
}
}