public function run() { $faker = Faker\Factory::create(); DB::table('users')->delete(); $user = User::create(['email' => '*****@*****.**', 'password' => Hash::make('123456'), 'user_name' => 'admin', 'ads_rise' => 5, 'blocked' => 0, 'balance' => 0]); foreach (range(2, 30) as $index) { $user = User::create(['email' => $faker->email, 'password' => Hash::make('1234'), 'user_name' => $faker->userName, 'ads_rise' => 5, 'blocked' => rand(0, 1), 'balance' => 0]); $city_id = Cities::orderBy(DB::raw('RAND()'))->first()->id; \ZaWeb\Profile\Models\Profile::create(['user_id' => $user->id, 'name' => $faker->firstName, 'last_name' => $faker->lastName, 'about' => $faker->sentence(10), 'city_id' => $city_id]); } }
public function run() { $faker = Faker\Factory::create(); DB::table('shops')->delete(); foreach (range(1, 3) as $index) { $city_id = \App\Models\Cities::orderBy(DB::raw('RAND()'))->first()->id; $user_id = rand(1, 3); $profile_id = \ZaWeb\Shops\Models\ShopProfile::orderBy(DB::raw('RAND()'))->first()->id; $attachment_id = \App\Models\Attachment::orderBy(DB::raw('RAND()'))->first()->id; \ZaWeb\Shops\Models\Shops::create(['user_id' => $user_id, 'city_id' => $city_id, 'capacity' => 300, 'attachment_id' => $attachment_id, 'profile_id' => $profile_id, 'created_at' => date('Y-m-d G:i:s'), 'updated_at' => date('Y-m-d G:i:s')]); } }
public function run() { $faker = Faker\Factory::create(); DB::table('advertisement')->delete(); foreach (range(1, 30) as $index) { $category_id = Category::orderBy(DB::raw('RAND()'))->first()->id; $city_id = Cities::orderBy(DB::raw('RAND()'))->first()->id; $type_id = AdType::orderBy(DB::raw('RAND()'))->first()->id; // $a_hash = AdsAttachment::orderBy(DB::raw('RAND()'))->first()->hash; Advertisement::create(['category_id' => $category_id, 'text' => $faker->paragraph(4), 'user_id' => 1, 'city_id' => $city_id, 'type_id' => $type_id, 'price' => 12345, 'approved' => rand(0, 1)]); } }
/** * Display a listing of the resource. * * @return Response */ public function index() { $cities = Cities::orderBy('id', 'desc')->paginate(5); return view('admin.cities.index', compact('cities')); }