本文整理汇总了PHP中Installer::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Installer::find方法的具体用法?PHP Installer::find怎么用?PHP Installer::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Installer
的用法示例。
在下文中一共展示了Installer::find方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
// return View::make('register.confirm');
$user = User::find($id);
$serials = $user->serials()->get();
//$installer = $user->installer()->first()->business_name;
if ($user->installer_id) {
$installer = Installer::find($user->installer_id);
}
// echo $user->installer_id;
// foreach($serials as $serial) {
// echo $serial->serial;
// }
return View::make('admin.user.view')->with('user', $user)->with('serials', $serials)->with('installer', $installer);
}
示例2: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
if ($this->isAdminRequest()) {
// delete
$installer = Installer::find($id);
$installer->delete();
// redirect
Session::flash('message', 'Successfully deleted the Installer!');
return Redirect::to('admin/installers');
}
}
示例3: import
public function import($name)
{
// echo $name;
// exit;
$file = '../laravel/app/storage/csv/' . $name . '.csv';
// echo $file;
// exit;
$allowedfilenames = array("serials", "installers");
if (in_array($name, $allowedfilenames)) {
//Parse into array
$array = $this->csvtoarray($file);
switch ($name) {
case 'serials':
foreach ($array as $item) {
$serial = new Serial();
$find = $serial->where('serial', '=', $item['serial'])->first();
if (!$find) {
$serial->model_id = $item['model_id'];
$serial->serial = $item['serial'];
$serial->save();
}
}
break;
case 'installers':
// echo "<pre>";
// print_r($array);
// echo "</pre>";
// exit;
$insertcount = 0;
$updatecount = 0;
foreach ($array as $item) {
$installer = new Installer();
$find = $installer->where('account_number', '=', $item['account_number'])->first();
if ($find->id) {
$installer = Installer::find($find->id);
}
$installer->account_number = trim($item['account_number']);
$installer->business_name = trim($item['business_name']);
$installer->address = trim($item['address']);
$installer->city = trim($item['city']);
$installer->state = trim($item['state']);
$installer->zip = trim($item['zip']);
$installer->phone = trim($item['phone']);
if ($installer->save()) {
if ($find->id) {
$updatecount++;
} else {
$insertcount++;
}
} else {
echo "Whoops";
exit;
}
}
echo "Updated: " . $updatecount . "<br />";
echo "Inserted: " . $insertcount . "<br />";
break;
}
}
// echo "<pre>";
// print_r($array);
// echo "</pre>";
}
示例4: getInstallerName
function getInstallerName()
{
App::import('Model', 'ScheduleManager.Installer');
$installer_model = new Installer();
return $installer_model->find("list", array("fields" => array("id", "name_lookup_id")));
}
示例5: Installer
function set_week_calendar_view($set_date = null, $prev = null, $next = null)
{
App::uses('Installer', 'ScheduleManager.Model');
$installerModel = new Installer();
$installers = $installerModel->find('all');
if (!empty($set_date)) {
$set_date = $this->formatDate(str_replace('-', '/', $set_date));
}
$this->set(compact('installers', 'set_date', 'prev', 'next'));
}