本文整理匯總了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"]);
}