本文整理汇总了PHP中Uuid::uuid4方法的典型用法代码示例。如果您正苦于以下问题:PHP Uuid::uuid4方法的具体用法?PHP Uuid::uuid4怎么用?PHP Uuid::uuid4使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Uuid
的用法示例。
在下文中一共展示了Uuid::uuid4方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createNewSite
private function createNewSite($markerSite)
{
$markerSite->id = Uuid::uuid4()->toString();
$markerSite->save();
Log::debug("Created " . $markerSite->id . " from " . $_SERVER['REMOTE_ADDR']);
$this->authService->createAuth($markerSite->id);
return $markerSite;
}
示例2: getAuditData
private function getAuditData($markerSite)
{
$auditData = $markerSite->toArray();
//$markerSite is row to update from atlas table, which contains extra column "date_changed"
unset($auditData["date_changed"]);
$auditData["archive_date"] = new DateTime();
$auditData["changed_by"] = $this->authService->getPrincipal($markerSite->id);
$auditData["site_uuid"] = $markerSite->id;
$auditData["id"] = Uuid::uuid4()->toString();
$auditData['distribution_name'] = $this->distroService->getDistributionName($markerSite->distribution);
return $auditData;
}
示例3: insertDaerahWisata
public function insertDaerahWisata()
{
$namaFile = Uuid::uuid4()->toString();
$config['upload_path'] = $this->gambarPath;
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 2000;
$config['file_name'] = $namaFile;
$this->load->library('upload', $config);
if (!$this->upload->do_upload('gambar')) {
} else {
$data = array('id' => Uuid::uuid4()->toString(), 'judul' => $this->input->post('judul'), 'gambar' => $this->upload->file_name, 'deskripsi' => $this->input->post('deskripsi'));
$this->DaerahWisata->insertDaerahWisata($data);
redirect('');
}
}
示例4: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('archive', function (Blueprint $table) {
if (Schema::hasColumn('archive', 'id')) {
DB::statement('alter table archive change `id` `site_uuid` VARCHAR(38);');
}
$table->string('id', 38);
});
$archives = DB::table('archive')->get();
foreach ($archives as $site) {
if (!$site->id) {
$param = array('id' => Uuid::uuid4()->toString());
DB::table('archive')->where('archive_date', '=', $site->archive_date)->update($param);
}
}
Schema::table('archive', function (Blueprint $table) {
$table->primary('id');
$table->enum('action', array('DELETE', 'UPDATE', 'ADD'))->nullable();
});
}
开发者ID:skvithalani,项目名称:openmrs-contrib-atlas,代码行数:25,代码来源:2014_07_15_060605_add_uuid_and_action_to_archive.php
示例5: pingPostModule
/**
* Post Ping function - Handle Ping from Atlas Module 2.0
* Never Used and deprecated
*/
public function pingPostModule()
{
$this->createTableIfNotPresent();
Log::debug("DATA received: " . Request::getContent());
$json = json_decode(Request::getContent(), true);
$date = new \DateTime();
$module = $json['id'];
Log::info('Module uuid: ' . $module);
$siteM = DB::table('auth')->where('token', '=', $module)->first();
if ($siteM == NULL) {
App::abort(403, 'Unauthorized');
}
$param = array('id' => $siteM->atlas_id, 'patients' => intval($json['patients']), 'encounters' => intval($json['encounters']), 'observations' => intval($json['observations']), 'atlas_version' => $json['atlasVersion'], 'date_created' => $date);
$site = DB::table('atlas')->where('id', '=', $param['id'])->first();
if ($site != null) {
DB::table('archive')->insert(array('archive_date' => $date, 'site_uuid' => $site->id, 'id' => Uuid::uuid4()->toString(), 'action' => 'UPDATE', 'type' => $site->type, 'longitude' => $site->longitude, 'latitude' => $site->latitude, 'name' => $site->name, 'url' => $site->url, 'image' => $site->image, 'contact' => $site->contact, 'changed_by' => 'module:' . $_SERVER['REMOTE_ADDR'], 'patients' => $site->patients, 'encounters' => $site->encounters, 'observations' => $site->observations, 'openmrs_version' => $openmrs_version, 'notes' => $site->notes, 'email' => $site->email, 'data' => $site->data, 'show_counts' => $site->show_counts, 'atlas_version' => $site->atlas_version, 'date_created' => $site->date_created));
unset($param['date_created']);
DB::table('atlas')->where('id', '=', $site->id)->update($param);
Log::debug("Updated " . $param['id'] . " from " . $_SERVER['REMOTE_ADDR']);
} else {
Log::debug("Site not found: " . $param['id'] . " from " . $_SERVER['REMOTE_ADDR']);
}
return 'SUCCES';
}
示例6: pingAtlasDelete
public function pingAtlasDelete()
{
$id = Input::get('id');
$user = Session::get(user);
$date = new \DateTime();
$site = DB::table('atlas')->where('id', '=', $id)->first();
$privileges = DB::table('auth')->where('token', '=', $user->uid)->where('atlas_id', '=', $param['id'])->where('privileges', '=', 'ALL')->first();
if ($user->role == 'ADMIN' && $privileges == NULL) {
$privileges = new Privileges(array('token' => $user->uid, 'principal' => 'admin:' . $user->uid, 'privileges' => 'ADMIN'));
}
Log::debug("Privileges: " . $privileges->principal . "/" . $privileges->privileges);
if ($site != null) {
DB::table('archive')->insert(array('site_uuid' => $site->id, 'id' => Uuid::uuid4()->toString(), 'type' => $site->type, 'longitude' => $site->longitude, 'latitude' => $site->latitude, 'name' => $site->name, 'url' => $site->url, 'image' => $site->image, 'contact' => $site->contact, 'changed_by' => $privileges->principal, 'patients' => $site->patients, 'encounters' => $site->encounters, 'observations' => $site->observations, 'notes' => $site->notes, 'email' => $site->email, 'data' => $site->data, 'action' => 'DELETE', 'openmrs_version' => $site->openmrs_version, 'atlas_version' => $site->atlas_version, 'date_created' => $site->date_created, 'show_counts' => $site->show_counts, 'created_by' => $site->created_by));
DB::table('auth')->where('atlas_id', '=', $id)->delete();
DB::table('atlas')->where('id', '=', $id)->delete();
Log::info("Deleted " . $deleteId . " from " . $_SERVER['REMOTE_ADDR']);
}
}
示例7: saveLogo
public function saveLogo($id)
{
$faculty = $this->get($id);
$uuid = Uuid::uuid4();
// ชื่อไฟล์
$storage_path = "app/faculties/{$id}/logo/";
// พาธ
$destination_path = storage_path($storage_path);
// เอาไว้ใน storage ถ้าเอาไว้ public ใช้ public_path($path)
Input::file('file')->move($destination_path, $uuid);
// save ไฟล์
$logo = $this->getLogoFromModel($faculty);
$logo->url = "/img/faculties/{$id}/logo/{$uuid}";
$faculty->logo()->save($logo);
return $logo;
}
示例8: testUuid4WithoutOpensslRandomPseudoBytes
/**
* @covers Rhumsaa\Uuid\Uuid::uuid4
* @covers Rhumsaa\Uuid\Uuid::generateBytes
* @covers Rhumsaa\Uuid\Uuid::uuidFromHashedName
*/
public function testUuid4WithoutOpensslRandomPseudoBytes()
{
Uuid::$forceNoOpensslRandomPseudoBytes = true;
$uuid = Uuid::uuid4();
$this->assertInstanceOf('Rhumsaa\\Uuid\\Uuid', $uuid);
$this->assertEquals(2, $uuid->getVariant());
$this->assertEquals(4, $uuid->getVersion());
}
示例9: testUuid4
/**
* @covers Rhumsaa\Uuid\Uuid::uuid4
* @covers Rhumsaa\Uuid\Uuid::uuidFromHashedName
*/
public function testUuid4()
{
$uuid = Uuid::uuid4();
$this->assertInstanceOf('Rhumsaa\\Uuid\\Uuid', $uuid);
$this->assertEquals(2, $uuid->getVariant());
$this->assertEquals(4, $uuid->getVersion());
}
示例10: sendMsg
public function sendMsg(Msg $msg)
{
$rid = (string) Uuid::uuid4();
$this->requestAdd('msg', $rid, array('msg' => $msg));
$data = array('rid' => $rid, 'version' => $msg->getVersion(), 'id' => $msg->getId(), 'srcNodeId' => $msg->getSrcNodeId(), 'srcSslKeyPub' => base64_encode($msg->getSrcSslKeyPub()), 'srcUserNickname' => $msg->getSrcUserNickname(), 'dstNodeId' => $msg->getDstNodeId(), 'body' => $msg->getBody(), 'password' => $msg->getPassword(), 'checksum' => $msg->getChecksum(), 'relayCount' => (int) $msg->getRelayCount() + 1, 'timeCreated' => (int) $msg->getTimeCreated(), 'hashcash' => $this->hashcashMint(static::HASHCASH_BITS_MAX));
return $this->dataSend($this->msgCreate('msg', $data));
}
示例11: generateSerial
public function generateSerial()
{
$serial = Uuid::uuid4();
$this->setSerial($serial);
return $serial;
}
示例12: storeBillProject
public function storeBillProject()
{
$user = new BillProject();
$uuid = Uuid::uuid4();
$user->name = Input::get('name');
$user->email = Input::get('email');
$user->password = Hash::make(Input::get('password'));
$user->uf = Input::get('uf');
$user->role_id = Input::get('role_id');
$user->cpf = Input::get('cpf');
$user->uuid = $uuid;
$user->save();
}