本文整理汇总了PHP中app\Location::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::all方法的具体用法?PHP Location::all怎么用?PHP Location::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Location
的用法示例。
在下文中一共展示了Location::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
public function edit($id)
{
$request = Request::with(['equipment', 'area', 'location', 'category', 'uploads', 'approvers', 'status', 'actions' => function ($query) {
$query->orderBy('created_at', 'desc');
}, 'actions.submitted', 'comments.author' => function ($query) {
$query->orderBy('created_at', 'asc');
}])->find($id);
if (is_null($request)) {
return view('security.not-found');
}
$data['request'] = $request;
$data['areas'] = Area::all(['id', 'name']);
$data['organizations'] = Organization::all();
$data['categories'] = Category::all(['id', 'name']);
$data['locations'] = Location::all(['id', 'name']);
$data['approvers'] = Approval::getRecent($id);
$data['hasApproved'] = Approval::hasApproved($id)->exists();
if ($request->Status->name == 'Approved') {
return view('request.view', $data);
}
if ($request->submitted_by != Auth::User()->id && !Auth::User()->hasRole(['administrator', 'approver'])) {
return view('security.401');
}
return view('request.edit', $data);
}
示例2: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$locations = Location::all()->toArray();
/*$receptionist = Receptionist::where('role_id', '=', 3)->get();*/
$receptionist = DB::table('users')->where('users.role_id', '=', 3)->join('locations', 'users.location_id', '=', 'locations.id')->get(['users.*', 'locations.name as location']);
return Response::json(array('allreceptionists' => $receptionist, 'locations' => $locations));
}
示例3: index
public function index(Manager $fractal, LocationTransformer $locationTransformer)
{
// show all
$records = Location::all();
$collection = new Collection($records, $locationTransformer);
$data = $fractal->createData($collection)->toArray();
return $this->respond($data);
}
示例4: postDeleteLocation
public function postDeleteLocation(Request $request)
{
$locationId = intval($request->input('location_id'));
if ($locationId) {
Location::find($locationId)->delete();
return response(Location::all());
}
return redirect('dashboard/locations')->withErrors('No location id passed');
}
示例5: edit
public function edit($partnerID)
{
if (!Auth::check() || !Auth::user()->is_admin) {
return response(view('errors.403', ['error' => $this->errorMessages['incorrect_permissions']]), 403);
}
$partner = Partner::where('id', $partnerID)->firstOrFail();
return view('partners.edit', ['partner' => $partner], ['locations' => Location::all()]);
//return view('partners.edit')->with(['partner'=>$partner]);
}
示例6: create
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
$locations = Location::all()->lists('project_id');
$project_list = Project::where('id', '>', '1');
foreach ($locations as $location) {
$project_list = $project_list->where('id', '!=', $location);
}
$project_list = $project_list->lists('name', 'id')->toArray();
return view('pages.add-location', compact('project_list'));
}
示例7: edit
public function edit($id)
{
$locations = Location::all();
$options = array();
foreach ($locations as $location) {
$options[$location->name] = $location->description;
}
$user = FbUser::where('id', $id)->firstOrFail();
return view('facebook.user.edit')->with('options', $options)->with('user', $user);
}
示例8: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->comment(sprintf("Deleting %d products and %d locations", Product::count(), Location::count()));
Product::all()->each(function ($doc) {
$doc->delete();
});
Location::all()->each(function ($doc) {
$doc->delete();
});
}
示例9: create
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
$total = Location::all()->count();
$used = Location::has('targets')->count();
$free = $total - $used;
if ($free < 5) {
return redirect('/locations');
}
$location = Location::pickUnused(1);
return view('experiments.create', compact('location', 'free'));
}
示例10: edit
public function edit($id)
{
$locations = Location::all();
$options = array();
foreach ($locations as $location) {
$options[$location->name] = $location->description;
}
$group = FbGroup::where('id', $id)->firstOrFail();
$tags = Tag::all();
return view('facebook.group.edit')->with('tags', $tags)->with('options', $options)->with('group', $group);
}
示例11: index
public function index()
{
$totalNumber = 5;
// number of items to take for each section
$data = ["events" => Event::where('end_datetime', '>', date(time()))->get()->take($totalNumber), "partners" => Partner::all()->take($totalNumber), "news" => News::all()->take($totalNumber), "media" => Media::where('processed', 0)->get()->take($totalNumber * 2)->chunk(3), "staffs" => User::where('is_staff', 1)->get(), "locations" => Location::all()->take($totalNumber)];
$i = 0;
foreach ($data['events'] as $event) {
$mediaCount = count(Media::where('processed', false)->where('event_id', $event->id)->get());
$data['events'][$i]->mediaCount = $mediaCount;
$i++;
}
return View::make('admin.index')->with($data);
}
示例12: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$user = Session::get('user');
$allowed_departments = Session::get('allowed_departments');
$match_departments = Session::get('match_departments');
$playlists = Playlist::whereIn('department_id', $match_departments)->get();
// Return all locations or only the ones th user is assigned to
if ($user->is_super_user) {
$locations = Location::all();
} else {
$locations = Location::whereIn('department_id', $match_departments)->get();
}
$data = array('locations' => $locations, 'allowed_departments' => $allowed_departments, 'user' => $user, 'playlists' => $playlists);
return view('pages/locations', $data);
}
示例13: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request)
{
$location = Location::all();
$i = 1;
foreach ($location as $key => $value) {
$location1 = 'location1_' . $i;
$location2 = 'location2_' . $i;
$getid = 'id_' . $i;
$id = Input::get($getid);
$location = Location::find($id);
$location->location1 = Input::get($location1);
$location->location2 = Input::get($location2);
$location->update();
$i++;
}
return redirect('location/management/')->with('message', 'You have done successfully');
}
示例14: create
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create(Request $request)
{
$locations = null;
$tags = null;
if ($request->session()->get('tags') == null) {
$tags = Tag::all();
$request->session()->put('tags', $tags);
} else {
$tags = $request->session()->get('tags');
}
if ($request->session()->get('locations') == null) {
$locations = Location::all();
$request->session()->put('locations', $locations);
} else {
$locations = $request->session()->get('locations');
}
return view('facebook.campaign.create')->with('locations', $locations)->with('tags', $tags);
}
示例15: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$groups = FbGroup::where('tags', 'Undefined')->get();
$total = count($groups);
$group = $groups[0];
$tags = null;
if ($request->session()->get('tags') == null) {
$tags = Tag::all();
$request->session()->put('tags', $tags);
} else {
$tags = $request->session()->get('tags');
}
$locations = Location::all();
$options = array();
foreach ($locations as $location) {
$options[$location->name] = $location->description;
}
return view('facebook.group.index2')->with('options', $options)->with('total', $total)->with('group', $group)->with('tags', $tags);
}