本文整理匯總了PHP中app\Profile::truncate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Profile::truncate方法的具體用法?PHP Profile::truncate怎麽用?PHP Profile::truncate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Profile
的用法示例。
在下文中一共展示了Profile::truncate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
public function run()
{
$faker = Faker\Factory::create();
Profile::truncate();
foreach (range(1, 20) as $index) {
Profile::create(['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'job' => $faker->word, 'motto' => $faker->sentence, 'about' => $faker->paragraph(4), 'favorite' => $faker->paragraph(4), 'favorite_img' => $faker->imageUrl(300, 200), 'sample_img1' => $faker->imageUrl(300, 200), 'sample_img2' => $faker->imageUrl(300, 200), 'sample_img3' => $faker->imageUrl(300, 200), 'location' => $faker->country, 'phone' => $faker->phoneNumber]);
}
}
示例2: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// clear table
\App\Profile::truncate();
// add 1st row
\App\Profile::create(['user_id' => 1, 'firstname' => 'Хангал', 'lastname' => 'Жаргалсайхан', 'headline' => 'Оюутан', 'address' => 'БГД-н 4-р хороолол 45-20', 'desired_salary' => 800000, 'phone' => '89237842', 'summary' => 'Laravel Framework ашиглах болон, Full stack development хийх сонирхолтой']);
// add 2nd row
\App\Profile::create(['user_id' => 2, 'firstname' => 'Khangal', 'lastname' => 'Kola', 'headline' => 'Undergraduate', 'address' => 'New York', 'phone' => '12345678', 'summary' => 'I wanna be a rockstar.']);
}