• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Uuid类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Uuid的典型用法代码示例。如果您正苦于以下问题:PHP Uuid类的具体用法?PHP Uuid怎么用?PHP Uuid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Uuid类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: onBeforeWrite

 public function onBeforeWrite()
 {
     if (!$this->owner->SystemID) {
         $uuid = new Uuid();
         $this->owner->SystemID = $uuid->get();
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-syncrotron,代码行数:7,代码来源:SyncroSiteConfig.php


示例2: __construct

 protected function __construct($id = null)
 {
     if ($id !== null && !is_scalar($id)) {
         throw new InvalidIdException();
     }
     $this->id = null === $id ? Uuid::generate() : $id;
 }
开发者ID:kreta,项目名称:kreta,代码行数:7,代码来源:Id.php


示例3: testFromString

 public function testFromString()
 {
     $uuid1 = Uuid::fromString($this->uuid1);
     $uuid4 = Uuid::fromString($this->uuid4);
     $this->assertSame($uuid1->toString(), $this->uuid1);
     $this->assertSame($uuid4->toString(), $this->uuid4);
 }
开发者ID:lorenzomar,项目名称:valueobject,代码行数:7,代码来源:UuidTest.php


示例4: store

 /**
  * Store a newly created resource in storage.
  * POST /group
  *
  * @return Response
  */
 public function store($id)
 {
     //create sub team
     //return Redirect::action('SubController@create',$id)->with( 'notice', 'This action cannot be perform at this moment, please comeback soon.');
     $user = Auth::user();
     $club = $user->clubs()->FirstOrFail();
     $parent_team = Team::find($id);
     $uuid = Uuid::generate();
     $validator = Validator::make(Input::all(), Team::$rules_group);
     if ($validator->passes()) {
         $team = new Team();
         $team->id = $uuid;
         $team->name = Input::get('name');
         $team->season_id = $parent_team->season_id;
         $team->program_id = $parent_team->program_id;
         $team->description = $parent_team->description;
         $team->early_due = $parent_team->getOriginal('early_due');
         $team->early_due_deadline = $parent_team->early_due_deadline;
         $team->due = $parent_team->getOriginal('due');
         $team->plan_id = $parent_team->plan_id;
         $team->open = $parent_team->open;
         $team->close = $parent_team->close;
         $team->max = Input::get('max');
         $team->status = $parent_team->getOriginal('status');
         $team->parent_id = $parent_team->id;
         $team->club_id = $club->id;
         $team->allow_plan = 1;
         $status = $team->save();
         if ($status) {
             return Redirect::action('TeamController@show', $parent_team->id)->with('messages', 'Group created successfully');
         }
     }
     $error = $validator->errors()->all(':message');
     return Redirect::action('SubController@create', $id)->withErrors($validator)->withInput();
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:41,代码来源:SubController.php


示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     session_start();
     if (!isset($_SESSION['AUTH']) || $_SESSION['AUTH'] == false) {
         \App::abort(500, 'User not authenticated');
     }
     $post = file_get_contents('php://input');
     $data = json_decode($post, true);
     if ($data['ipAddr'] != null && $data['type'] != null) {
         //creates a new VM in middleware database. Expects ipaddress and type
         $v = new vm();
         $v->id = \Uuid::generate(4);
         $v->ipAddr = $data['ipAddr'];
         $v->type = $data['type'];
         try {
             //emit request to make vm
             $redis = \Redis::connection();
             // Using the Redis extension provided client
             $redis->publish('demeter', json_encode(array('command' => 'init', 'vm' => $v->id->string, 'type' => $v->type, 'netId' => $_SESSION['AUTH_USER'])));
             if ($v->save()) {
                 echo "success";
             } else {
                 \App::abort(500, 'VM could not be created, please contact an Administrator');
             }
         } catch (Exception $e) {
             \App::abort(500, 'VM could not be created, please contact an Administrator');
         }
     } else {
         \App::abort(500, 'VM could not be created, please contact an Administrator');
     }
 }
开发者ID:DCUnit711,项目名称:Demeter,代码行数:37,代码来源:vmController.php


示例6: run

 public function run()
 {
     $participants = DB::table('event_participant')->get();
     foreach ($participants as $participant) {
         $player = Player::find($participant->player_id);
         $user = User::find($participant->user_id);
         $event = Evento::find($participant->event_id);
         $payment = Payment::find($participant->payment_id);
         $uuid = Uuid::generate();
         $new = new Participant();
         $new->id = $uuid;
         $new->firstname = $player->firstname;
         $new->lastname = $player->lastname;
         $new->due = $event->getOriginal('fee');
         $new->early_due = $event->getOriginal('early_fee');
         $new->early_due_deadline = $event->early_deadline;
         $new->method = 'full';
         $new->plan_id = Null;
         $new->player_id = $player->id;
         $new->event_id = $participant->event_id;
         $new->accepted_on = $participant->created_at;
         $new->accepted_by = $user->profile->firstname . " " . $user->profile->lastname;
         $new->accepted_user = $participant->user_id;
         $new->status = 1;
         $new->created_at = $participant->created_at;
         $new->updated_at = $participant->updated_at;
         $new->save();
         $update = Item::where('payment_id', '=', $payment->id)->firstOrFail();
         $update->participant_id = $uuid;
         $update->save();
     }
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:32,代码来源:FollowersTableSeeder.php


示例7: postStore

 public function postStore(UsersRequest $request = null, $id = "")
 {
     $input = $request->except('save_continue', 'password_confirmation');
     $result = '';
     if (\Input::hasFile('photo')) {
         $photo = (new \ImageUpload($input))->upload();
     }
     if ($id == "") {
         $input['id'] = \Uuid::generate();
         $input['photo'] = isset($photo) ? $photo : "";
         $input['password'] = bcrypt($input['password']);
         $query = $this->model->create($input);
         $result = $query->id;
     } else {
         if (\Input::hasFile('photo')) {
             $input['photo'] = isset($photo) ? $photo : "";
         }
         if (isset($input['password']) && $input['password'] != "") {
             $input['password'] = bcrypt($input['password']);
         }
         $this->model->find($id)->update($input);
         $result = $id;
     }
     $save_continue = \Input::get('save_continue');
     $redirect = empty($save_continue) ? $this->url : $this->url . '/edit/' . $result;
     return redirect($redirect)->with('message', 'Berhasil tambah data Pengguna!');
 }
开发者ID:Abdulhmid,项目名称:inventory,代码行数:27,代码来源:Users.php


示例8: postStoreTransaction

 public function postStoreTransaction(Request $request)
 {
     $input = $request->only('idItemPart', 'qty', 'priceBuy');
     try {
         $arrayData = [];
         $itemId = explode(",", $input['idItemPart']);
         $qty = explode(",", $input['qty']);
         $priceBuy = explode(",", $input['priceBuy']);
         $keyTrans = \Uuid::generate();
         for ($i = 0; $i < count($itemId); $i++) {
             /* Update Stok */
             $this->updateStok($itemId[$i], $qty[$i]);
             /* Update Price */
             $this->updatePrice($itemId[$i], $priceBuy[$i]);
             /* Update Price */
             $this->updatePriceSell($itemId[$i], $priceBuy[$i]);
             $insert['item_id'] = $itemId[$i];
             $insert['qty'] = $qty[$i];
             $insert['price_buy'] = $priceBuy[$i];
             $insert['expedition'] = "-";
             $insert['created_at'] = \Carbon\Carbon::now();
             $insert['updated_at'] = \Carbon\Carbon::now();
             $insert['key_transaction'] = $keyTrans;
             array_push($arrayData, $insert);
         }
         $data = $this->transactionBuy->insert($arrayData);
         return $keyTrans;
     } catch (Exception $e) {
         return "0";
     }
 }
开发者ID:Abdulhmid,项目名称:inventory,代码行数:31,代码来源:Buying.php


示例9: store

 /**
  * Store a newly created resource in storage.
  * POST /plan
  *
  * @return Response
  */
 public function store()
 {
     $user = Auth::user();
     $club = $user->clubs()->FirstOrFail();
     $validator = Validator::make(Input::all(), Plan::$rules);
     $uuid = Uuid::generate();
     //check if recurrences
     if ($validator->passes()) {
         $amount = Input::get('total') - Input::get('initial');
         $recurring = Input::get('recurring');
         $recurrences = $amount / $recurring;
         $recidual = fmod($amount, $recurring);
         if ($recidual > 0) {
             return Redirect::action('PlanController@create')->withInput()->with('warning', "Please check the recurring amount and initial amount.");
         }
         $plan = new Plan();
         $plan->id = $uuid;
         $plan->name = Input::get('name');
         $plan->total = Input::get('total');
         $plan->initial = Input::get('initial');
         $plan->recurring = Input::get('recurring');
         $plan->recurrences = $recurrences;
         $plan->frequency_id = Input::get('frequency_id');
         $plan->on = Input::get('on');
         $plan->club_id = $club->id;
         $status = $plan->save();
         if ($status) {
             return Redirect::action('PlanController@index')->with('notice', 'Event created successfully');
         }
         return Redirect::action('PlanController@create')->with('warning', $status);
     }
     $error = $validator->errors()->all(':message');
     return Redirect::action('PlanController@create')->withErrors($validator)->withInput();
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:40,代码来源:PlanController.php


示例10: file

 /**
  * Copy a random file from the source directory to the target directory and returns the filename/fullpath
  *
  * @param string $sourceDirectory
  *        	The directory to look for random file taking
  * @param string $targetDirectory        	
  * @param boolean $fullPath
  *        	Whether to have the full path or just the filename
  * @return string
  */
 public static function file($sourceDirectory = '/tmp', $targetDirectory = '/tmp', $fullPath = true)
 {
     if (!is_dir($sourceDirectory)) {
         throw new \InvalidArgumentException(sprintf('Source directory %s does not exist or is not a directory.', $sourceDirectory));
     }
     if (!is_dir($targetDirectory)) {
         throw new \InvalidArgumentException(sprintf('Target directory %s does not exist or is not a directory.', $targetDirectory));
     }
     if ($sourceDirectory == $targetDirectory) {
         throw new \InvalidArgumentException('Source and target directories must differ.');
     }
     // Drop . and .. and reset array keys
     $files = array_filter(array_values(array_diff(scandir($sourceDirectory), array('.', '..'))), function ($file) use($sourceDirectory) {
         return is_file($sourceDirectory . DIRECTORY_SEPARATOR . $file) && is_readable($sourceDirectory . DIRECTORY_SEPARATOR . $file);
     });
     if (empty($files)) {
         throw new \InvalidArgumentException(sprintf('Source directory %s is empty.', $sourceDirectory));
     }
     $sourceFullPath = $sourceDirectory . DIRECTORY_SEPARATOR . static::randomElement($files);
     $destinationFile = Uuid::uuid() . '.' . pathinfo($sourceFullPath, PATHINFO_EXTENSION);
     $destinationFullPath = $targetDirectory . DIRECTORY_SEPARATOR . $destinationFile;
     if (false === copy($sourceFullPath, $destinationFullPath)) {
         return false;
     }
     return $fullPath ? $destinationFullPath : $destinationFile;
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:36,代码来源:File.php


示例11: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('groups')->insert(['group_id' => '1', 'group_name' => 'Admin']);
     // \DB::statement("SELECT pg_catalog.setval(pg_get_serial_sequence('groups', 'group_id'), "
     //      . "MAX(group_id)) FROM groups");
     DB::table('users')->insert(['id' => Uuid::generate(), 'group_id' => '1', 'username' => 'admin', 'email' => '[email protected]', 'password' => bcrypt('123456'), 'name' => 'Admin Sistem Inventory', 'active' => '1', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
 }
开发者ID:Abdulhmid,项目名称:inventory,代码行数:12,代码来源:UsersTableSeeder.php


示例12: testNameBased

 public function testNameBased()
 {
     // test UUID parts
     $uuid = explode('-', Uuid::nameBased('bar'));
     $this->assertEquals(5, count($uuid));
     $this->assertEquals(true, ctype_xdigit($uuid[0]), 'time-low');
     $this->assertEquals(true, ctype_xdigit($uuid[1]), 'time-mid');
     $this->assertEquals(true, ctype_xdigit($uuid[2]), 'time-high-and-version');
     $this->assertEquals(true, ctype_xdigit($uuid[3]), 'clock-seq-and-reserved / clock-seq-low');
     $this->assertEquals(true, ctype_xdigit($uuid[4]), 'node');
     $this->assertEquals(8, strlen($uuid[0]), 'time-low');
     $this->assertEquals(4, strlen($uuid[1]), 'time-mid');
     $this->assertEquals(4, strlen($uuid[2]), 'time-high-and-version');
     $this->assertEquals(4, strlen($uuid[3]), 'clock-seq-and-reserved / clock-seq-low');
     $this->assertEquals(12, strlen($uuid[4]), 'node');
     $this->assertEquals(5, hexdec($uuid[2]) >> 12, 'Set the four most significant bits (bits 12 through 15) of the time_hi_and_version field to the appropriate 4-bit version number from Section 4.1.3.');
     $this->assertEquals(2, hexdec($uuid[3]) >> 14, 'Set the two most significant bits (bits 6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively.');
     // the UUIDs generated at different times from the same name in the same
     // namespace MUST be equal.
     $uuid = Uuid::nameBased('foobar');
     sleep(1);
     $this->assertEquals($uuid, Uuid::nameBased('foobar'));
     // the UUIDs generated from two different names in the same namespace
     // should be different (with very high probability).
     $this->assertTrue(Uuid::nameBased('foobar') != Uuid::nameBased('bar'));
 }
开发者ID:seytar,项目名称:psx,代码行数:26,代码来源:UuidTest.php


示例13: boot

 /**
  * Bootstrap the UUID service.
  *
  * @return void
  */
 public function boot()
 {
     $this->loadTranslationsFrom(__DIR__ . '../Lang', '');
     Validator::extend('uuid', function ($attribute, $value, $parameters) {
         return \Uuid::isValid($value);
     });
 }
开发者ID:sammarks,项目名称:laravel-uuid,代码行数:12,代码来源:UuidServiceProvider.php


示例14: valid

 public static function valid($uuid)
 {
     if (!self::$uuid) {
         self::$uuid = Uuid::getInstance();
     }
     return self::$uuid->test($uuid);
 }
开发者ID:noccy80,项目名称:cherryphp,代码行数:7,代码来源:uuidgenerator.php


示例15: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     Segment::truncate();
     # Seed the table.
     $segments = [['Seg_Name' => 'Age', 'Seg_CreatedOn' => Carbon\Carbon::now(), 'Seg_CreatedBy' => 1, 'Seg_GUID' => (string) Uuid::generate(4)], ['Seg_Name' => 'Location', 'Seg_CreatedOn' => Carbon\Carbon::now(), 'Seg_CreatedBy' => 1, 'Seg_GUID' => (string) Uuid::generate(4)]];
     Segment::insert($segments);
 }
开发者ID:bambangadrian,项目名称:mailmarketing,代码行数:13,代码来源:SegmentSeeder.php


示例16: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     CampaignType::truncate();
     # Seed the table.
     $campaignTypes = [['Cgt_Name' => 'Plain Text', 'Cgt_CreatedOn' => Carbon\Carbon::now(), 'Cgt_CreatedBy' => 1, 'Cgt_GUID' => (string) Uuid::generate(4)], ['Cgt_Name' => 'HTML', 'Cgt_CreatedOn' => Carbon\Carbon::now(), 'Cgt_CreatedBy' => 1, 'Cgt_GUID' => (string) Uuid::generate(4)]];
     CampaignType::insert($campaignTypes);
 }
开发者ID:bambangadrian,项目名称:mailmarketing,代码行数:13,代码来源:CampaignTypeSeeder.php


示例17: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     MailTrackingStatus::truncate();
     # Seed the table.
     $mailTrackingStatuses = [['Mts_Name' => 'open', 'Mts_CreatedOn' => Carbon\Carbon::now(), 'Mts_CreatedBy' => 1, 'Mts_GUID' => (string) Uuid::generate(4)], ['Mts_Name' => 'read', 'Mts_CreatedOn' => Carbon\Carbon::now(), 'Mts_CreatedBy' => 1, 'Mts_GUID' => (string) Uuid::generate(4)], ['Mts_Name' => 'click', 'Mts_CreatedOn' => Carbon\Carbon::now(), 'Mts_CreatedBy' => 1, 'Mts_GUID' => (string) Uuid::generate(4)], ['Mts_Name' => 'subscribe', 'Mts_CreatedOn' => Carbon\Carbon::now(), 'Mts_CreatedBy' => 1, 'Mts_GUID' => (string) Uuid::generate(4)], ['Mts_Name' => 'unsubscribe', 'Mts_CreatedOn' => Carbon\Carbon::now(), 'Mts_CreatedBy' => 1, 'Mts_GUID' => (string) Uuid::generate(4)], ['Mts_Name' => 'bounce', 'Mts_CreatedOn' => Carbon\Carbon::now(), 'Mts_CreatedBy' => 1, 'Mts_GUID' => (string) Uuid::generate(4)], ['Mts_Name' => 'fail', 'Mts_CreatedOn' => Carbon\Carbon::now(), 'Mts_CreatedBy' => 1, 'Mts_GUID' => (string) Uuid::generate(4)]];
     MailTrackingStatus::insert($mailTrackingStatuses);
 }
开发者ID:bambangadrian,项目名称:mailmarketing,代码行数:13,代码来源:MailTrackingStatusSeeder.php


示例18: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     Subscriber::truncate();
     # Seed the table.
     $subscribers = [['Sbr_ImportFromID' => 4, 'Sbr_EmailAddress' => '[email protected]', 'Sbr_FirstName' => 'Maita', 'Sbr_LastName' => 'Elfrida', 'Sbr_Address1' => 'Perumahan Bagasasi Blok F3 No.1', 'Sbr_Address2' => 'Cibarusah', 'Sbr_Address3' => 'Cikarang Selatan', 'Sbr_CreatedOn' => Carbon\Carbon::now(), 'Sbr_CreatedBy' => 1, 'Sbr_GUID' => (string) Uuid::generate(4)]];
     Subscriber::insert($subscribers);
 }
开发者ID:bambangadrian,项目名称:mailmarketing,代码行数:13,代码来源:SubscriberSeeder.php


示例19: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     ImportFrom::truncate();
     # Seed the table.
     $importFrom = [['Imf_Name' => 'Old Database', 'Imf_Description' => 'Import from old database', 'Imf_CreatedOn' => Carbon\Carbon::now(), 'Imf_CreatedBy' => 1, 'Imf_GUID' => (string) Uuid::generate(4)], ['Imf_Name' => 'Excel', 'Imf_Description' => 'Import from excel', 'Imf_CreatedOn' => Carbon\Carbon::now(), 'Imf_CreatedBy' => 1, 'Imf_GUID' => (string) Uuid::generate(4)], ['Imf_Name' => 'Register', 'Imf_Description' => 'Registered subscriber', 'Imf_CreatedOn' => Carbon\Carbon::now(), 'Imf_CreatedBy' => 1, 'Imf_GUID' => (string) Uuid::generate(4)], ['Imf_Name' => 'Manual Input', 'Imf_Description' => 'Manual input subscriber registration', 'Imf_CreatedOn' => Carbon\Carbon::now(), 'Imf_CreatedBy' => 1, 'Imf_GUID' => (string) Uuid::generate(4)]];
     ImportFrom::insert($importFrom);
 }
开发者ID:bambangadrian,项目名称:mailmarketing,代码行数:13,代码来源:ImportFromSeeder.php


示例20: prepareRequest

 /**
  * add UUID to existing request
  * @return Request
  */
 public function prepareRequest()
 {
     // get all input
     $request = Request::all();
     // attach uuid as id
     $request['id'] = Uuid::generate(4)->string;
     return $request;
 }
开发者ID:amirmasoud,项目名称:API,代码行数:12,代码来源:postService.php



注:本文中的Uuid类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP VBX_User类代码示例发布时间:2022-05-23
下一篇:
PHP Utils_Unicode类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap