本文整理汇总了PHP中Store::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::find方法的具体用法?PHP Store::find怎么用?PHP Store::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Store
的用法示例。
在下文中一共展示了Store::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDishes
/**
* show all dishes for a specific store
*
* @param integer $id
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
*/
public function getDishes($id)
{
if ($store = Store::find($id)) {
return View::make('store.dishes', ['store' => $store]);
}
return Redirect::back();
}
示例2: getMenu
public function getMenu($id)
{
$img = Store::find($id);
$path = $img->menu;
$mime = $img->mime;
header("Content-Type: {$mime}");
readfile($path);
exit;
}
示例3: getStores
function getStores()
{
$brand_stores = array();
$db_stores = $GLOBALS['DB']->query("SELECT stores.* FROM\n brands JOIN brands_stores ON (brands.id = brands_stores.brand_id)\n JOIN stores ON (brands_stores.store_id = stores.id)\n WHERE brands.id = {$this->getId()};");
foreach ($db_stores as $store) {
$found_store = Store::find($store['id']);
array_push($brand_stores, $found_store);
}
return $brand_stores;
}
示例4: testFind
function testFind()
{
$name = "Clides";
$test_store = new Store($name);
$test_store->save();
$name2 = "Marthas";
$test_store2 = new Store($name2);
$test_store2->save();
$result = Store::find($test_store2->getId());
$this->assertEquals($test_store2, $result);
}
示例5: detail
public function detail($id)
{
$param['store'] = StoreModel::find($id);
$param['servedCount'] = QueueModel::where('store_id', $id)->count();
$userId = Session::has('user_id') ? Session::get('user_id') : 0;
$queueNo = QueueModel::where('user_id', $userId)->where('store_id', $id)->whereRaw('DATE(created_at) = DATE(NOW())')->orderBy('created_at', 'DESC')->get();
if (count($queueNo) > 0) {
$queueNo = $queueNo[0]->queue_no;
} else {
$queueNo = null;
}
$param['queueNo'] = $queueNo;
return View::make('user.store.detail')->with($param);
}
示例6: apply
public function apply()
{
if (Input::has('store_id')) {
$storeId = Input::get('store_id');
$status = StatusModel::where('store_id', $storeId)->first();
$queueNo = $status->last_queue_no;
$status->last_queue_no = $queueNo + 1;
$status->save();
$store = StoreModel::find($storeId);
return Response::json(['result' => 'success', 'msg' => '', 'queue_no' => $queueNo + 1, 'created_at' => $status->updated_at->format('Y-m-d H:i:s'), 'logo' => HTTP_PATH . "/assets/img/logo.png"]);
} else {
return Response::json(['result' => 'failed', 'msg' => 'Invalid Request']);
}
}
示例7: postCreate
/**
* create a delivery
*
* @return \Illuminate\Http\RedirectResponse
*/
public function postCreate()
{
$nowDateTime = $this->getDateTimeAfterNow(5);
$validator = Validator::make(Input::all(), array('store' => 'required|numeric|exists:stores,id', 'closing_time' => 'date_format:Y-m-d H:i:s|after:' . $nowDateTime->format('Y-m-d H:i:s')));
if ($validator->passes() === false) {
return Redirect::back()->withErrors($validator);
}
$storeId = Input::get('store');
$closingTime = Input::get('closing_time');
$store = Store::find($storeId);
$delivery = new Delivery();
$delivery->user()->associate(Auth::user());
$delivery->store()->associate($store);
$delivery->closing_time = $closingTime;
$delivery->save();
// push notification
F4H\Pusher::push('delivery.created', array('user' => Auth::user()->email, 'store' => $store->name, 'closing_time' => $closingTime, 'delivery' => $delivery->getKey()));
return Redirect::route('delivery.active');
}
示例8: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$file = $this->argument('file');
$storeId = $this->argument('storeId');
if (file_exists($file) === false || is_readable($file) === false) {
$this->error('"' . $file . '" does not exist or is not readable.');
return;
}
if (Store::find($storeId)->getKey() === null) {
$this->error('A store with ID "' . $storeId . '" does not exist.');
return;
}
$this->info('Importing dishes from "' . $file . '" to store with ID ' . $storeId . '...');
$header = $this->readLine();
while (($line = $this->readLine()) !== FALSE) {
$dish = $this->getNewObject($this->mergeData($header, $line));
$dish->save();
$this->comment(' - "' . $dish->name . '" ID: ' . $dish->getKey());
}
$this->info('Importing stores completed.');
}
示例9: test_find
function test_find()
{
//Arrange
$retailer = "Nordstrom";
$address = "1234 SW Main Street";
$phone = "123-456-7890";
$id = null;
$test_store = new Store($retailer, $address, $phone, $id);
$test_store->save();
$retailer2 = "Macys";
$address2 = "400 SW 6th Avenue";
$phone2 = "888-888-8888";
$test_store2 = new Store($retailer2, $address2, $phone2, $id);
$test_store2->save();
//Act
$result = Store::find($test_store2->getId());
//Assert
$this->assertEquals($test_store2, $result);
}
示例10: test_find
function test_find()
{
//Arrange
$id = null;
$store_name = "Fred Meyers";
$test_store = new Store($id, $store_name);
$test_store->save();
$id2 = null;
$store_name2 = "Walmart";
$test_store2 = new Store($id2, $store_name2);
$test_store2->save();
//Act
$result = Store::find($test_store->getId());
//Assert
$this->assertEquals($test_store, $result);
}
示例11: testFind
function testFind()
{
//Arrange
$name = "shoe store";
$location = "1234 nw 1st street";
$id = 4;
$test_store = new Store($name, $location, $id);
$test_store->save();
$name2 = "other store";
$location2 = "5555 sw 2nd street";
$id2 = 3;
$test_store2 = new Store($name2, $location2, $id2);
$test_store2->save();
//Act
$result = Store::find($test_store2->getId());
//Assert
$this->assertEquals($test_store2, $result);
}
示例12: test_find
function test_find()
{
//Arrange
$store_name = "Portland Running Company";
$id = null;
$test_store = new Store($store_name, $id);
$test_store->save();
$store_name2 = "New Balance";
$test_store2 = new Store($store_name2, $id);
$test_store2->save();
//Act
$id = $test_store->getId();
$result = Store::find($id);
//Assert
$this->assertEquals($test_store, $result);
}
示例13: save_store
public function save_store()
{
$id = Input::get('id');
$white = Input::file('logo_white');
$color = Input::file('logo');
$store = Store::find($id);
$cities = City::all();
$zipcodes = array();
foreach ($cities as $city) {
array_push($zipcodes, $city->zipcode);
}
$flag = 0;
if (!$store) {
$store = new Store();
$flag = 1;
}
$store->name = Input::get('name');
$store->minimum_order_amount = Input::get('minimum_order_amount');
$validator = Validator::make(array('white' => $white, 'color' => $color), array('white' => 'required|mimes:jpeg,bmp,png', 'color' => 'required|mimes:jpeg,bmp,png'));
if ($validator->fails()) {
$error_messages = $validator->messages();
$response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401);
$response_code = 200;
$message = "Invalid Input File";
$type = "failed";
return Redirect::to('/admin/stores')->with('type', $type)->with('message', $message);
} else {
if (Input::hasFile('logo')) {
$store->logo_url = upload_image(Input::file('logo'));
} else {
if ($flag == 1) {
$store->logo_url = web_url() . "/uploads/default_store_logo.png";
}
}
if (Input::hasFile('logo_white')) {
$store->logo_white_url = upload_image(Input::file('logo_white'));
} else {
if ($flag == 1) {
$store->logo_white_url = web_url() . "/uploads/default_white_store_logo.png";
}
}
$store->save();
StoreLocation::where('store_id', $id)->delete();
foreach ($zipcodes as $zipcode) {
$store_location = new StoreLocation();
$store_location->store_id = $store->id;
$store_location->zipcode = $zipcode;
$store_location->save();
}
$message = "Successfully updated the store";
$type = "success";
return Redirect::to('/admin/stores')->with('type', $type)->with('message', $message);
}
}
示例14: test_find
function test_find()
{
//Arrange
$name = "House of Shoes and Waffles";
$address = "123 Street";
$phone = "4-44";
$test_store = new Store($name, $address, $phone);
$test_store->save();
$name2 = "Bob's Shoe Palace";
$address2 = "456 Main Street";
$phone2 = "1-800-NEW-SHOE";
$test_store2 = new Store($name, $address, $phone);
$test_store2->save();
//Act
$result = Store::find($test_store2->getId());
//Assert
$this->assertEquals($test_store2, $result);
}
示例15: test_find
function test_find()
{
//Arrange
$store_name = "Flying Shoes";
$id = 1;
$test_store = new Store($store_name, $id);
$test_store->save();
//Act
$result = Store::find($test_store->getId());
//Assert
$this->assertEquals($test_store, $result);
}