本文整理匯總了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);
}
}