本文整理汇总了PHP中Store::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::where方法的具体用法?PHP Store::where怎么用?PHP Store::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Store
的用法示例。
在下文中一共展示了Store::where方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
public function edit($id)
{
$param['pageNo'] = 3;
$param['agent'] = AgentModel::find($id);
$param['stores'] = StoreModel::where('company_id', Session::get('company_id'))->get();
return View::make('company.agent.edit')->with($param);
}
示例2: index
public function index()
{
$param['stores'] = StoreModel::where('company_id', Session::get('company_id'))->paginate(10);
$param['pageNo'] = 2;
if ($alert = Session::get('alert')) {
$param['alert'] = $alert;
}
return View::make('company.store.index')->with($param);
}
示例3: function
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/', ['before' => 'auth', function () {
$store = Auth::user();
$api = new TiendaNube\API($store->tiendanube_id, $store->access_token, 'Awesome App (contact@awesome.com)');
$response = $api->get("products");
return View::make('hello')->with('products', $response->body)->with('lang', $response->main_language);
}]);
Route::get('/auth', function () {
//Obtain access token
$code = Input::get('code');
$auth = new TiendaNube\Auth(Config::get('tiendanube.client_id'), Config::get('tiendanube.client_secret'));
$store_info = $auth->request_access_token($code);
//Create or edit existing store with the provided access token
$store = Store::where('tiendanube_id', $store_info['store_id'])->first();
if ($store == null) {
$store = new Store();
$store->tiendanube_id = $store_info['store_id'];
}
$store->access_token = $store_info['access_token'];
$store->save();
//Login and redirect to homepage
Auth::login($store);
return Redirect::to('/');
});
示例4: delete_store
public function delete_store()
{
$id = Request::segment(4);
Store::where('id', $id)->delete();
Department::where('store_id', $id)->delete();
Shelf::where('store_id', $id)->delete();
Product::where('store_id', $id)->delete();
StoreLocation::where('store_id', $id)->delete();
$message = "Successfully deleted the store";
$type = "success";
return Redirect::to('/admin/stores')->with('type', $type)->with('message', $message);
}
示例5: agent
public function agent()
{
$param['pageNo'] = 9;
$startDate = Input::has('startDate') ? Input::get('startDate') : '';
$endDate = Input::has('endDate') ? Input::get('endDate') : '';
if ($startDate == '' || $endDate == '') {
$endDate = date('Y-m-d');
$startDate = substr($endDate, 0, 8) . "01";
}
$storeId = Input::has('storeId') ? Input::get('storeId') : '';
$companyId = Session::get('company_id');
$prefix = DB::getTablePrefix();
$sqlGroup = "SELECT agent_id, COUNT(*) AS cnt, SUM(TIME_TO_SEC(TIMEDIFF(end_time, start_time))) AS activeTime\n FROM " . $prefix . "process\n WHERE end_time != ''\n AND (DATE(created_at) BETWEEN DATE('{$startDate}') AND DATE('{$endDate}'))\n GROUP BY agent_id";
$sql = "SELECT t1.id, t1.name, t1.email, t1.phone\n FROM " . $prefix . "agent t1, " . $prefix . "store t2\n WHERE t1.store_id = t2.id\n AND t2.company_id = {$companyId}";
if ($storeId != '') {
$sql .= " AND t1.store_id = {$storeId}";
}
$sql = "SELECT t1.*, IFNULL(t2.cnt, 0) AS cnt, IFNULL(t2.activeTime, 0) as activeTime \n FROM ({$sql}) t1\n LEFT JOIN ({$sqlGroup}) t2 ON t1.id = t2.agent_id";
$param['agents'] = DB::select($sql);
$param['storeId'] = $storeId;
$param['startDate'] = $startDate;
$param['endDate'] = $endDate;
$param['stores'] = StoreModel::where('company_id', Session::get('company_id'))->get();
return View::make('company.dashboard.agent')->with($param);
}
示例6: storeExists
private function storeExists($store)
{
return Store::where('name', '=', $store->name)->get()->count() > 0;
}