本文整理汇总了PHP中app\Location::Where方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::Where方法的具体用法?PHP Location::Where怎么用?PHP Location::Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Location
的用法示例。
在下文中一共展示了Location::Where方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllResturantUsers
public function getAllResturantUsers($id)
{
$users = User::Where('resturant_id', '=', $id)->Where('role_id', '=', 2)->get();
$response = array();
if (sizeof($users) > 0) {
foreach ($users as $user) {
$user_locations = UserLocation::Where('user_id', '=', $user['id'])->lists('location_id');
$alluserlocation = Location::WhereIn('id', $user_locations)->get();
$user_actions = UserAction::Where('user_id', '=', $user['id'])->first();
array_push($response, ["user" => $user, "locations" => $alluserlocation, "mainmenu" => unserialize($user_actions['maincard']), "weeklymenu" => unserialize($user_actions['weeklymenu']), "items" => unserialize($user_actions['items'])]);
}
$allresturantlocations = Location::Where('resturantId', '=', $id)->get();
return response()->json(["Response" => 'success', "data" => $response, "AllLocations" => $allresturantlocations]);
}
return response()->json(['Response' => 'error', 'message' => 'There was an error processing your request']);
}
示例2: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index($id)
{
//
$franchises = Franchise::Where('resturantId', '=', $id)->get();
$location = Location::Where('resturantId', '=', $id)->get();
$response = array();
if (sizeof($franchises) > 0) {
foreach ($franchises as $franchise) {
$user = User::Where('franchise_id', '=', $franchise['id'])->get();
array_push($response, ["Franchise" => $franchise, "users" => $user]);
}
return response()->json(['Response' => 'success', 'data' => $response, 'locations' => $location]);
} else {
return response()->json(['Response' => 'error']);
}
}
示例3: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id, $locationid)
{
//
$allLocations = UserLocation::Where('location_id', '=', $locationid)->lists('user_id');
UserAction::WhereIn('user_id', $allLocations)->delete();
UserLocation::WhereIn('user_id', $allLocations)->delete();
User::WhereIn('id', $allLocations)->delete();
Location::Where('id', '=', $locationid)->delete();
return response()->json(["Response" => "success", "message" => "Location Deleted"]);
}