本文整理汇总了PHP中app\Item::truncate方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::truncate方法的具体用法?PHP Item::truncate怎么用?PHP Item::truncate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Item
的用法示例。
在下文中一共展示了Item::truncate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::statement("SET foreign_key_checks = 0");
Item::truncate();
DB::statement("SET foreign_key_checks = 1");
$cause = Cause::where('cause_title', 'Liberation of minor sex')->get()->first();
Item::create(['cause_id' => $cause->cause_id, 'item_name' => 'blanket', 'item_description' => 'for minor sex', 'item_required' => 20, 'item_received' => 7, 'item_worth' => 11]);
Item::create(['cause_id' => $cause->cause_id, 'item_name' => 'bedsheets', 'item_description' => 'for minor sex', 'item_required' => 45, 'item_received' => 23, 'item_worth' => 9]);
$cause = Cause::where('cause_title', 'Child Support')->get()->first();
Item::create(['cause_id' => $cause->cause_id, 'item_name' => 'books', 'item_description' => 'for child support', 'item_required' => 200, 'item_received' => 159, 'item_worth' => 14]);
Item::create(['cause_id' => $cause->cause_id, 'item_name' => 'desks', 'item_description' => 'for child support', 'item_required' => 100, 'item_received' => 67, 'item_worth' => 15]);
// $cause = Cause::where('cause_title',
// 'Flood Donation PK')->get()->first();
// Item::create([
// 'cause_id' => $cause->cause_id,
// 'item_name' => 'blanket',
// 'item_description' => 'for flood donation',
// 'item_required' => 500,
// 'item_received' => 322,
// 'item_worth' => 12
// ]);
// Item::create([
// 'cause_id' => $cause->cause_id,
// 'item_name' => 'clothes',
// 'item_description' => 'for flood donation',
// 'item_required' => 900,
// 'item_received' => 545,
// 'item_worth' => 15
// ]);
// $cause = Cause::where('cause_title',
// 'Earthquake PK')->get()->first();
// Item::create([
// 'cause_id' => $cause->cause_id,
// 'item_name' => 'cash',
// 'item_description' => 'for earthquake',
// 'item_required' => 500000,
// 'item_received' => 123410,
// 'item_worth' => 1
// ]);
// Item::create([
// 'cause_id' => $cause->cause_id,
// 'item_name' => 'clothes',
// 'item_description' => 'for earthquake',
// 'item_required' => 100,
// 'item_received' => 67,
// 'item_worth' => 15
// ]);
}
开发者ID:umarhussain15,项目名称:web_semester_project_integration_repo_Jan16,代码行数:53,代码来源:ItemTableSeeder.php
示例2: run
public function run()
{
Item::truncate();
factory(App\Item::class, 12)->create();
}
示例3: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Item::truncate();
$data = [['type_id' => 1, 'name' => "cánh rồng", 'image_url' => 'images/items/canh.jpg']];
Item::insert($data);
}