本文整理匯總了PHP中Reply::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP Reply::create方法的具體用法?PHP Reply::create怎麽用?PHP Reply::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Reply
的用法示例。
在下文中一共展示了Reply::create方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
public function run()
{
$faker = Faker::create();
$users = User::lists('id');
$topics = Topic::lists('id');
foreach (range(1, 500) as $index) {
Reply::create(['user_id' => $faker->randomElement($users), 'topic_id' => $faker->randomElement($topics), 'body' => $faker->sentence()]);
}
foreach (range(1, 60) as $index) {
Reply::create(['user_id' => 1, 'topic_id' => $faker->randomElement($topics), 'body' => $faker->sentence()]);
}
}
示例2: reply
public function reply()
{
if (Session::has('account') && Session::has('password')) {
$inputs = Input::all();
$id = Input::get('id');
$rule = array('reply' => 'required');
$validator = Validator::make($inputs, $rule);
if ($validator->fails()) {
return Redirect::to('seven')->withErrors($validator);
}
Reply::create(array('memo' => nl2br(htmlspecialchars(Input::get('reply'))), 'name' => Session::get('name'), 'photo' => Session::get('photo'), 'id' => $id));
//存進資料庫裡 &&檢查是否有XSS
return Redirect::to('seven');
}
return Redirect::to('seven');
}