当前位置: 首页>>代码示例>>PHP>>正文


PHP Photo::where方法代码示例

本文整理汇总了PHP中Photo::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Photo::where方法的具体用法?PHP Photo::where怎么用?PHP Photo::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Photo的用法示例。


在下文中一共展示了Photo::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_index

 public function get_index($city = null)
 {
     $inputs = array('pmin' => Input::get('pmin'), 'pmax' => Input::get('pmax'), 'smin' => Input::get('smin'), 'smax' => Input::get('smax'), 'smoking' => Input::get('smoking'), 'pets' => Input::get('pets'), 'toilet' => Input::get('toilet'), 'shower' => Input::get('shower'), 'kitchen' => Input::get('kitchen'), 'order' => Input::get('order'));
     if (!is_null($city)) {
         $inputs['city'] = str_replace('-', ' ', $city);
     } else {
         $inputs['city'] = Input::get('city');
     }
     $rules = array('city' => 'exists:photos, city');
     $v = Validator::make($inputs['city'], $rules);
     $query = Room::where('status', '=', 'publish');
     if (!empty($inputs['city'])) {
         $city = $inputs['city'];
         $query->where(function ($query) use($city) {
             $query->where('city', 'LIKE', '%' . $city . '%');
             $query->or_where('description', 'LIKE', '%' . $city . '%');
             $query->or_where('title', 'LIKE', '%' . $city . '%');
         });
     }
     if (!empty($inputs['pmin']) && !empty($inputs['pmax'])) {
         $query->where('price', '>', $inputs['pmin']);
         $query->where('price', '<', $inputs['pmax']);
     }
     if (!empty($inputs['smin']) && !empty($inputs['smax'])) {
         $query->where('surface', '>', $inputs['smin']);
         $query->where('surface', '<', $inputs['smax']);
     }
     if (!empty($inputs['smoking'])) {
         $query->where('smoking', '=', $inputs['smoking']);
     }
     if (!empty($inputs['pets'])) {
         $query->where('pets', '=', $inputs['pets']);
     }
     if (!empty($inputs['toilet'])) {
         $query->where('toilet', '=', $inputs['toilet']);
     }
     if (!empty($inputs['shower'])) {
         $query->where('shower', '=', $inputs['shower']);
     }
     if (!empty($inputs['kitchen'])) {
         $query->where('kitchen', '=', $inputs['kitchen']);
     }
     if (!empty($inputs['order']) && $inputs['order'] == 'price' || $inputs['order'] == 'created_at') {
         $query->order_by($inputs['order'], 'desc');
     } else {
         $query->order_by("created_at", 'desc');
     }
     $total = $query->get();
     $rooms = $query->paginate(Room::$per_page);
     Input::flash();
     if (!$v->fails()) {
         $bgphoto = Photo::where('city', '=', $inputs['city'])->first();
         return View::make('home.search')->with('total', $total)->with('bgphoto', $bgphoto)->with('city', $city)->with('rooms', $rooms);
     } else {
         return View::make('home.search')->with('total', $total)->with('rooms', $rooms);
     }
 }
开发者ID:sanneterpstra,项目名称:Kamergenood,代码行数:57,代码来源:search.php

示例2: getSession

 public function getSession($id)
 {
     $data = array();
     $social_actions = SocialAction::with('socialTarget', 'user')->where('id', $id)->first();
     if ($social_actions == false) {
         return App::abort('404');
     }
     $photos = Photo::where('type_name', '=', 'social_actions')->where('type_id', '=', $social_actions->id)->where('status', '=', 1)->get();
     $donations = Donation::with(array('user'))->where('type_name', '=', 'social_actions')->where('type_id', '=', $social_actions->id)->where('status', '=', 1)->orderBy('id', 'desc')->get();
     $user = User::getUserId($social_actions->user_id);
     $social_target_id = SocialTarget::getAll();
     $social_action_category_id = SocialActionCategory::getAll();
     $city_id = City::getAll();
     $data = array('social_action' => $social_actions, 'photos' => $photos, 'donations' => $donations, 'user' => $user, 'social_target_id' => $social_target_id, 'social_action_category_id' => $social_action_category_id, 'city_id' => $city_id);
     Session::put('type_name', 'SocialAction');
     Session::put('type_id', $social_actions->social_target_id);
     return Redirect::route('buat-aksi-sosial');
 }
开发者ID:whiterun,项目名称:bagikasih-v2,代码行数:18,代码来源:SocialActionController.php

示例3: getSession

 public function getSession($id)
 {
     // init
     $data = array();
     $event = Events::where('id', $id)->first();
     if ($event == false) {
         return App::abort('404');
     }
     $data['view'] = $event;
     // // get photos
     $data['photos'] = Photo::where('type_name', '=', 'events')->where('type_id', '=', $event->id)->where('status', '=', 1)->get();
     $data['social_actions'] = SocialAction::with(array('city', 'category'))->join('social_action_events', 'social_action_events.social_action_id', '=', 'social_actions.id')->where('event_id', '=', $event->id)->where('social_actions.status', '=', 1)->orderBy('social_actions.id', 'desc')->get();
     $data['social_target_id'] = SocialTarget::getAll();
     $data['social_action_category_id'] = SocialActionCategory::getAll();
     $data['city_id'] = City::getAll();
     Session::put('type_name', 'Events');
     Session::forget('type_id');
     Session::put('event_id', $event['id']);
     return Redirect::route('buat-aksi-sosial');
 }
开发者ID:marthem,项目名称:bagikasih,代码行数:20,代码来源:EventController.php

示例4: show

 public function show($id)
 {
     // get social target
     $user = User::with('city')->find($id);
     if ($user == null) {
         return App::abort('404');
     }
     // init
     $data = array('menu' => $this->_menu, 'title' => 'Nama pengguna - ' . $user->firstname . ' ' . $user->lastname, 'description' => '', 'breadcrumb' => array('Pengguna Bagikasih' => route('admin.user'), $user->firstname => route('admin.user.show', $user->id)));
     $data['users'] = $user;
     $social_target = SocialTarget::with(array('city', 'category', 'user'))->where('user_id', $user->id)->get();
     // Get Social Target
     $data['social_target'] = $social_target;
     // Get Social Actions that related with this
     $data['social_actions'] = SocialAction::with(array('city', 'category', 'user'))->where('user_id', '=', $user->id)->orderBy('id', 'desc')->get();
     // Get Donations that related with this
     $data['donations'] = Donation::with(array('user'))->where('type_name', '=', 'users')->where('type_id', '=', $user->id)->orderBy('id', 'desc')->get();
     // Get Photos that related with this
     $data['photos'] = Photo::where('type_name', '=', 'users')->where('type_id', '=', $user->id)->orderBy('id', 'desc')->get();
     return View::make('admin.pages.user.show')->with($data);
 }
开发者ID:whiterun,项目名称:bagikasih-v2,代码行数:21,代码来源:AdminUserController.php

示例5: getSession

 public function getSession($id)
 {
     // init
     $data = array();
     // get social target data - with slug
     $social_target = SocialTarget::with(array('city', 'category'))->where('id', '=', $id)->where('status', '=', 1)->first();
     if ($social_target == null) {
         return App::abort('404');
     }
     // get photos
     $photos = Photo::where('type_name', '=', 'social_targets')->where('type_id', '=', $social_target->id)->where('status', '=', 1)->get();
     // get social actions
     $social_actions = SocialAction::with(array('city', 'category'))->where('social_target_id', '=', $social_target->id)->where('status', '=', 1)->orderBy('id', 'desc')->get();
     // set data
     $data = array('social_target' => $social_target, 'photos' => $photos, 'social_actions' => $social_actions);
     $data['social_target_id'] = SocialTarget::getAll();
     $data['social_action_category_id'] = SocialActionCategory::getAll();
     $data['city_id'] = City::getAll();
     Session::put('type_name', 'SocialTarget');
     Session::put('type_id', $social_target->id);
     return Redirect::route('buat-aksi-sosial');
 }
开发者ID:whiterun,项目名称:bagikasih-v2,代码行数:22,代码来源:SocialTargetController.php

示例6: remove

 /**
  * undocumented function
  *
  * @return void
  * @author 
  **/
 public static function remove($id)
 {
     $lokasi = public_path() . '/photos/';
     $data = Photo::where('id', $id)->first();
     if (is_null($data) === false) {
         $data->delete();
         if (file_exists($lokasi . $id . '.jpg')) {
             unlink($lokasi . $id . '.jpg');
         }
         if (file_exists($lokasi . 'thumb_' . $id . '.jpg')) {
             unlink($lokasi . 'thumb_' . $id . '.jpg');
         }
     }
 }
开发者ID:whiterun,项目名称:bagikasih-v2,代码行数:20,代码来源:Photo.php

示例7: foreach

 <?php 
if ($sliders = Dictionary::valuesBySlug('main_baners', function ($query) {
    $query->orderBy('lft', 'ASC');
}, 'all', TRUE)) {
    foreach ($sliders as $index => $slider) {
        if ($slider['photo']) {
            $sliders[$index]['photo_name'] = Photo::where('id', $slider['photo'])->pluck('name');
        }
    }
}
if ($communications = Dictionary::valuesBySlug('communications_units', function ($query) {
    $query->orderBy('lft', 'ASC');
}, 'all', TRUE)) {
    foreach ($communications as $index => $communication) {
        if ($communication['photo']) {
            $communications[$index]['photo_name'] = Photo::where('id', $communication['photo'])->pluck('name');
        }
    }
}
$gallery = array();
if (Gallery::where('name', 'Галерея на главной')->exists()) {
    $gallery = Gallery::where('name', 'Галерея на главной')->first()->photos;
}
?>
@extends(Helper::layout())
@section('style')
@stop
@section('content')
    @if(count($sliders))
        <div class="index-slider js-index-slider">
            <div class="slider__list">
开发者ID:Grapheme,项目名称:zemaktiv,代码行数:31,代码来源:index.blade.php

示例8: updatePost

 public function updatePost()
 {
     if (Request::isMethod('post')) {
         $input = Input::all();
         $updateEvent = SocialTarget::UpdateSocialTarget($input);
         $CountPhoto = Photo::where('tmp', Session::get('time'))->count();
         if ($CountPhoto > 0) {
             Photo::updatePhotos('social_targets', $input['id']);
             Photo::roolback();
         }
         if ($updateEvent != 'ok') {
             // get session validation
             Session::put('validasi', 'social_targets');
             Session::flash('validasi', $updateEvent);
             return Redirect::route('admin.social-target.update', $input['id'])->withInput();
         } else {
             Session::flash('sukses', 'Target Sosial Berhasil di Update');
             return Redirect::route('admin.social-target')->withInput();
         }
     }
 }
开发者ID:marthem,项目名称:bagikasih,代码行数:21,代码来源:AdminSocialTargetController.php

示例9: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $photo = Photo::where('id', $id);
     $photo->delete();
     return Response::json(array('error' => false, 'message' => 'photo deleted'), 200);
 }
开发者ID:jbrown25,项目名称:PhotoSharing-PHP-backend,代码行数:12,代码来源:PhotoController.php

示例10: updatePost

 public function updatePost()
 {
     if (Request::isMethod('post')) {
         $input = Input::all();
         $updateEvent = Events::UpdateEvent($input);
         // check if any mutliple upload photo
         $CountPhoto = Photo::where('user_id', Auth::user()->id)->where('tmp', Session::get('time'))->count();
         if ($CountPhoto > 0) {
             // update photo
             Photo::updatePhotos('events', $input['id']);
             Photo::rollback();
         }
         if ($updateEvent != 'ok') {
             // get session validation
             Session::put('validasi', 'event');
             Session::flash('validasi', $updateEvent);
             return Redirect::route('admin.event.update', $input['id'])->withInput();
         } else {
             Session::flash('sukses', 'Events Berhasil di Update');
             return Redirect::route('admin.event')->withInput();
         }
     }
 }
开发者ID:whiterun,项目名称:bagikasih-v2,代码行数:23,代码来源:AdminEventController.php

示例11: update

 /**
  * Update the specified resource in storage.
  * PUT /articles/{slug}
  *
  * @param  int $slug
  * @return Response
  */
 public function update($slug)
 {
     $thumbPath = Input::get('thumbPath');
     $thumbId = Input::get('thumbId');
     $image = Input::file('image');
     $article = Article::where('slug', $slug)->first();
     $article->title = Input::get('title');
     $article->body = Input::get('body');
     $article->category_id = Input::get('category_id');
     $article->save();
     if ($image) {
         File::delete($thumbPath);
         $file = Photo::where('id', $thumbId)->delete();
         $thumb = new Photo();
         $image = Input::file('image');
         $filename = time() . '-' . $image->getClientOriginalName();
         $destinationPath = public_path('thumbs/' . $filename);
         $a = Image::make($image->getRealPath())->fit(1280, 720)->save($destinationPath, 50);
         // SAVE TO DB
         $thumb->image = 'thumbs/' . $filename;
         $thumb->article_id = $article->id;
         $thumb->save();
         return Redirect::to('/dashboard')->with('message', 'Thumbnail updated successfully');
     } else {
         return Redirect::to('/dashboard')->with('message', 'Article Updated successfully');
     }
     // return View::make('admin.home')->withMessage('Article Saved!');
 }
开发者ID:tprifti,项目名称:Blog,代码行数:35,代码来源:ArticlesController.php

示例12: getAlbumIdYoungerThanDay

 public static function getAlbumIdYoungerThanDay($year, $month, $day, $pagination = 30)
 {
     $day = Photo::checkDay($year, $month, $day);
     return Photo::where(function ($query) use($year, $month, $day) {
         $query->where(DB::raw('YEAR(created_at)'), '>', $year)->orWhere(function ($iq) use($year, $month, $day) {
             $iq->where(DB::raw('YEAR(created_at)'), '=', $year)->where(DB::raw('MONTH(created_at)'), '>', $month)->orWhere(function ($iiq) use($year, $month, $day) {
                 $iiq->where(DB::raw('YEAR(created_at)'), '=', $year)->where(DB::raw('MONTH(created_at)'), '=', $month)->where(DB::raw('DAYOFMONTH(created_at)'), '>=', $day);
             });
         });
     })->lists('album_id');
 }
开发者ID:rituzy,项目名称:iblog,代码行数:11,代码来源:Photo.php

示例13: deleteUploadedImageFile

 public static function deleteUploadedImageFile($image_id)
 {
     if ($image_id) {
         $photo = Photo::where('id', $image_id)->first();
         if (File::exists(Config::get('site.galleries_photo_dir') . '/' . $photo->name)) {
             File::delete(Config::get('site.galleries_photo_dir') . '/' . $photo->name);
         }
         $photo->delete();
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:Grapheme,项目名称:newyork.bar,代码行数:13,代码来源:admin_uploads.controller.php

示例14: updatePost

 public function updatePost()
 {
     if (Request::isMethod('post')) {
         $input = Input::all();
         $updateSocialAction = SocialAction::UpdateSocialAction($input);
         // check if any mutliple upload photo
         $CountPhoto = Photo::where('tmp', Session::get('time'))->count();
         if ($CountPhoto > 0) {
             Photo::updatePhotos('social_actions', $input['id']);
             Photo::roolback();
         }
         if ($updateSocialAction != 'ok') {
             Session::flash('validasi', $updateSocialAction);
             return Redirect::route('admin.social-action.update', array($input['id']))->withInput();
         } else {
             // get session validation
             Session::put('validasi', 'social_actions');
             Session::flash('sukses', 'Aksi Sosial Berhasil di Update');
             return Redirect::route('admin.social-action')->withInput();
         }
     }
 }
开发者ID:whiterun,项目名称:bagikasih-v2,代码行数:22,代码来源:AdminSocialActionController.php

示例15: function

    }
});
Route::get('users', function () {
    $users = User::all();
    return Response::json(array('error' => false, 'users' => $users), 200);
});
Route::get('passwords', function () {
    $users = User::all();
    foreach ($users as $user) {
        echo $user->password;
    }
});
//index for list
Route::get('api/v1/photos', array('uses' => 'PhotoController@showPhotosIndex'));
Route::get('api/v1/photos/{user_id}', function ($user_id) {
    $photos = Photo::where('user_id', $user_id)->get();
    if ($user_id == Auth::user()->id) {
        return Response::json(array('error' => false, 'edit' => true, 'photos' => $photos), 200);
    } else {
        return Response::json(array('error' => false, 'edit' => false, 'photos' => $photos), 200);
    }
});
Route::group(array('prefix' => 'api/v1/'), function () {
    Route::resource('myphotos', 'PhotoController');
});
Route::get('login', array('uses' => 'HomeController@showLogin'));
// route to process the form
Route::post('login', array('uses' => 'HomeController@doLogin'));
Route::post('register', array('uses' => 'HomeController@doRegister'));
Route::get('logout', array('uses' => 'HomeController@showLogout'));
Route::post('logout', array('uses' => 'HomeController@doLogout'));
开发者ID:jbrown25,项目名称:PhotoSharing-PHP-backend,代码行数:31,代码来源:routes.php


注:本文中的Photo::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。