本文整理汇总了PHP中Driver::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Driver::save方法的具体用法?PHP Driver::save怎么用?PHP Driver::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Driver
的用法示例。
在下文中一共展示了Driver::save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Driver();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Driver'])) {
$model->attributes = $_POST['Driver'];
if ($model->save()) {
$this->redirect(array('index'));
}
}
$this->render('create', array('model' => $model));
}
示例2: setUpCarsAndDrivers
public function setUpCarsAndDrivers()
{
Doctrine::createTablesFromArray(array('Car', 'Driver'));
$bmw = new Car();
$bmw->make = 'BMW';
$bmw->save();
$this->cars['bmw'] = $bmw;
$audi = new Car();
$audi->make = 'Audi';
$audi->save();
$this->cars['audi'] = $audi;
$kiro = new Driver();
$kiro->name = 'Kiril Zyapkov';
$kiro->save();
$this->drivers['kiro'] = $kiro;
$emo = new Driver();
$emo->name = 'Emil Ivanov';
$emo->save();
$this->drivers['emo'] = $emo;
}
示例3: save
public function save($filename = null, $permissions = null)
{
extract(parent::save($filename, $permissions));
$this->run_queue();
$this->add_background();
$filetype = $this->image_extension;
$old = '"' . $this->image_temp . '"';
$new = '"' . $filename . '"';
if (($filetype == 'jpeg' or $filetype == 'jpg') and $this->config['quality'] != 100) {
$quality = '"' . $this->config['quality'] . '%"';
$this->exec('convert', $old . ' -quality ' . $quality . ' ' . $new);
} else {
$this->exec('convert', $old . ' ' . $new);
}
if ($this->config['persistence'] === false) {
$this->reload();
}
return $this;
}
示例4: saveNewDriver
public function saveNewDriver()
{
$code = Input::get('code');
$first = Input::get('first');
$last = Input::get('last');
$email = Input::get('email');
$password = Input::get('password');
$gsmNumber = Input::get('gsm_number');
$carId = Input::get('car_id');
$timeZone = Input::get('time_zone');
$languageId = Input::get('language_id');
try {
$user = new Users();
$user->first = $first;
$user->last = $last;
$user->email = $email;
$user->password = Hash::make($password);
$user->role_id = Roles::DRIVER_ROLE_ID;
$user->language_id = $languageId;
$user->time_zone = $timeZone;
$user->save();
$driver = new Driver();
$driver->user_id = $user->id;
$driver->code = $code;
$driver->first = $first;
$driver->last = $last;
$driver->gsm_number = $gsmNumber;
$driver->car_id = $carId;
$driver->save();
$result = array('success' => true);
} catch (Exception $ex) {
\Log::error(__METHOD__ . ' | error :' . print_r($ex, 1));
$result = array('success' => false);
}
return $result;
}
示例5: edit_help
public function edit_help($user)
{
switch ($user->type) {
case 'customer':
Customer::where('id', '=', $user->id)->delete();
break;
case 'driver':
Driver::where('id', '=', $user->id)->delete();
break;
case 'business':
Business::where('id', '=', $user->id)->delete();
break;
default:
break;
}
$user->type = Input::get('type');
$user->save();
switch (Input::get('type')) {
case 'driver':
$driver = new Driver();
$driver->id = $user->id;
$driver->first_name = Input::get('first_name');
$driver->last_name = Input::get('last_name');
$driver->phone = Input::get('phone');
$driver->home_address = Input::get('address');
$driver->credit_card = Input::get('credit_card');
$driver->cvv = Input::get('cvv');
$driver->expiry_date = Input::get('expiry_date');
$driver->car_type = Input::get('car_type');
$driver->cab_no = Input::get('cab_no');
$driver->flag = Input::get('flag');
$driver->rate = Input::get('rate');
$driver->hour = Input::get('hour');
$driver->save();
break;
case 'customer':
$customer = new Customer();
$customer->id = $user->id;
$customer->first_name = Input::get('first_name');
$customer->last_name = Input::get('last_name');
$customer->phone = Input::get('phone');
$customer->home_address = Input::get('address');
$customer->credit_card = Input::get('credit_card');
$customer->cvv = Input::get('cvv');
$customer->expiry_date = Input::get('expiry_date');
$customer->save();
break;
case 'business':
$business = new Business();
$business->id = $user->id;
$business->business_name = Input::get('business_name');
$business->phone = Input::get('phone');
$business->home_address = Input::get('address');
$business->credit_card = Input::get('credit_card');
$business->cvv = Input::get('cvv');
$business->expiry_date = Input::get('expiry_date');
$business->save();
break;
}
}
示例6: save
public function save($filename = null, $permissions = null)
{
extract(parent::save($filename, $permissions));
$this->run_queue();
$this->add_background();
$filetype = $this->image_extension;
if ($filetype == 'jpg' or $filetype == 'jpeg') {
$filetype = 'jpeg';
}
if ($this->imagick->getImageFormat() != $filetype) {
$this->imagick->setImageFormat($filetype);
}
if ($this->imagick->getImageFormat() == 'jpeg' and $this->config['quality'] != 100) {
$this->imagick->setImageCompression(Fuel_Imagick::COMPRESSION_JPEG);
$this->imagick->setImageCompressionQuality($this->config['quality']);
$this->imagick->stripImage();
}
file_put_contents($filename, $this->imagick->getImageBlob());
if ($this->config['persistence'] === false) {
$this->reload();
}
return $this;
}
示例7: post_add
public function post_add()
{
$files = Input::file('photo');
$input = Input::all();
try {
unset($input['photo']);
if (is_array($files) && isset($files['error']) && $files['error'] == 0) {
$success = Resizer::open($files)->resize(200, 200, 'auto')->save(path('public') . 'photo/' . str_replace(' ', '-', $input['nip']) . '.jpg', 90);
}
//$input = $input + array('photo'=>str_replace(' ', '-', $input['nip']).'.jpg');
//Driver::create($input);
$driver = new Driver();
$driver->name = $input['name'];
$driver->nip = $input['nip'];
$driver->ktp = $input['ktp'];
$driver->sim = $input['sim'];
$driver->phone = $input['phone'];
$driver->brith_place = $input['brith_place'];
$driver->date_of_birth = $input['date_of_birth'];
$driver->address = $input['address'];
$driver->kelurahan = $input['kelurahan'];
$driver->kecamatan = $input['kecamatan'];
$driver->kota = $input['kota'];
$driver->fg_blocked = Input::get('fg_blocked', 0);
$driver->driver_status = Input::get('driver_status', 2);
$driver->kpp_validthrough = $input['kpp_validthrough'];
$driver->city_id = $input['city_id'];
$driver->pool_id = $input['pool_id'];
$driver->pool_id = $input['pool_id'];
if ($files) {
$driver->photo = str_replace(' ', '-', $input['nip']) . '.jpg';
}
$driver->save();
return Redirect::to('drivers');
} catch (Exception $e) {
return 'Error Insert';
}
}