本文整理汇总了PHP中Str::quickRandom方法的典型用法代码示例。如果您正苦于以下问题:PHP Str::quickRandom方法的具体用法?PHP Str::quickRandom怎么用?PHP Str::quickRandom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Str
的用法示例。
在下文中一共展示了Str::quickRandom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: identify
public function identify()
{
if (empty($this->identifier)) {
$identifier = \Str::quickRandom();
$post = Post::where('identifier', $identifier)->first();
if ($post) {
$this->identify();
} else {
$this->identifier = $identifier;
$this->save();
}
}
}
示例2: SaveNewCampaign
public function SaveNewCampaign()
{
$rules = array('campaign_name' => 'required|min:1');
$validator = Validator::make(Input::all(), $rules);
$isUnique = Helpers::isCampaignNameUnique(trim(Input::get('campaign_name')));
$messages = $validator->messages();
if ($validator->fails() || !$isUnique) {
return Redirect::to(URL::previous())->withErrors($validator)->withInput()->with('unique', !$isUnique ? "Oops! Campaign name already exists. Please enter another name" : '');
} else {
$campaignID = Str::quickRandom(6) . strtotime('now') . Session::get("account_id");
DB::table('tbl_campaigns')->insert(array('uniqueid' => $campaignID, 'user_id' => Session::get("account_id"), 'creationtime' => date("Y-m-d H:i:s"), 'lastupdatetime' => date("Y-m-d H:i:s"), 'campaignstatus' => 'Draft', 'campaigname' => Input::get('campaign_name'), 'approvalstatus' => 'Pending'));
$u = URL::route('campaign_info', array('campaign' => $campaignID));
return Redirect::to($u);
}
}