示例#1
0
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(App\Models\User::class, function ($faker) {
    return ['name' => $faker->name, 'email' => $faker->email, 'username' => str_random(10), 'password' => bcrypt(1234), 'date_of_birth' => $faker->date, 'phone' => $faker->numberBetween(9000, 9999) . $faker->numberBetween(00, 999999), 'gender' => ['M', 'F'][array_rand(['M', 'F'])], 'address' => $faker->address, 'avatar' => $faker->imageUrl(300, 300, 'people', true, 'Faker'), 'user_type_id' => App\Models\UserType::all()->random()->id, 'school_id' => App\Models\School::all(['id'])->random()->id, 'status' => ['ACTIVE', 'WAITING_APPROVAL', 'BLOCKED'][array_rand(['ACTIVE', 'WAITING_APPROVAL', 'BLOCKED'])], 'remember_token' => str_random(10)];
});
$factory->define(App\Models\Message::class, function ($faker) {
    return ['sender_id' => App\Models\User::all()->random()->id, 'receiver_id' => App\Models\User::all()->random()->id, 'message' => $faker->paragraph, 'is_read' => ['', '1'][array_rand(['', '1'])]];
});
$factory->define(App\Models\RelatedUser::class, function ($faker) {
    return ['user_id' => App\Models\User::all()->random()->id, 'related_id' => App\Models\User::all()->random()->id, 'status' => ['ALLOW', 'DENY', 'NOT_YET_ALLOWED'][array_rand(['APPROVED', 'DENIED', 'NOT_YET_ALLOWED'])]];
});
$factory->define(App\Models\CourseSchool::class, function ($faker) {
    return ['course_id' => App\Models\Course::all()->random()->id, 'school_id' => App\Models\School::all()->random()->id];
});
$factory->define(App\Models\Student::class, function ($faker) {
    $user = factory('App\\Models\\User')->make();
    $user->user_type_id = 1;
    $user->username = '******' . (App\Models\User::count() + 1);
    $user->save();
    return ['course_school_id' => App\Models\CourseSchool::all()->random()->id, 'roll_no' => $faker->numberBetween(1, 60), 'admission_no' => $faker->numberBetween(100, 9999), 'year_of_admission' => $faker->year, 'user_id' => $user->id];
});
$factory->define(App\Models\Staff::class, function ($faker) {
    $user = factory('App\\Models\\User')->make();
    $user->user_type_id = 2;
    $user->username = '******' . (App\Models\User::count() + 1);
    $user->save();
    return ['department' => $faker->word, 'user_id' => $user->id];
});
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $publicPath = env('PUBLIC_PATH');
     $schools = array(['name' => 'Peace Public School', 'location' => 'Manglore', 'address' => 'Peace Public School,
                      Kallapu, Post Permannur,
                      Thokkottu, Mangalore - 575017,
                      0824-2469796, 09243332506,
                      mangalore@peaceschools.in', 'contact_person' => 'Mr. Yusuf', 'short_description' => 'Students are brought up in a diversified environment which have people from different states and countries to learn them the importance of equality.', 'long_description' => 'Students are brought up in a diversified environment which have people from different states and countries to learn them the importance of equality.', 'thumbnail_path' => url($publicPath . "staticPages/images/schools/commingsoon.jpg"), 'image_path' => url($publicPath . "staticPages/images/schools/commingsoonBig.jpg")], ['name' => 'Peace Public School', 'location' => 'Kasargod', 'address' => 'Peace Public School,
                      MP Campus,Periadka PO,
                      Shiribagilu,
                      Kasaragod- 671124,
                      04994-241788, 099-95-511060,
                      kasaragod@peaceschools.in', 'contact_person' => 'Ms. Deepthi', 'short_description' => 'Peace school Kasargod has well designed buildings and furniture to make the students feel homey and comfortable and to give them the awareness that learning is an interesting process.', 'long_description' => 'Peace school Kasargod has well designed buildings and furniture to make the students feel homey and comfortable and to give them the awareness that learning is an interesting process.', 'thumbnail_path' => url($publicPath . "staticPages/images/schools/kasargod.jpg"), 'image_path' => url($publicPath . "staticPages/images/schools/kasargodBig.jpg")], ['name' => 'Peace International School', 'location' => 'Trikaripur', 'address' => 'Peace International School, 
                     Ayitty Jn, Trikaripur,
                     Kasaragod - 671310,
                     +91 98-46-945345, 04672-214301,
                     trikaripur@peaceschools.in', 'contact_person' => 'Mr. Shahid', 'short_description' => 'Students learn based on international curriculum along with Islamic studies covering all facets of Islam.', 'long_description' => 'Students learn based on international curriculum along with Islamic studies covering all facets of Islam.', 'thumbnail_path' => url($publicPath . "staticPages/images/schools/trikaripur.jpg"), 'image_path' => url($publicPath . "staticPages/images/schools/trikaripurBig.jpg")], ['name' => 'Peace Public School', 'location' => 'Payangadi', 'address' => 'Peace Public School
                       Vilayancode
                       Near Petrol Pump
                       Pilathara - 670501
                       98-95-335511
                       payangadi@peaceschools.in', 'contact_person' => 'Mr. Rahees', 'short_description' => 'Training in Quran recitation with proper thajweed and memorization(Hifz).Student behaviour is enlightened by value education and moral science classes.', 'long_description' => 'Training in Quran recitation with proper thajweed and memorization(Hifz).Student behaviour is enlightened by value education and moral science classes.', 'thumbnail_path' => url($publicPath . "staticPages/images/schools/commingsoon.jpg"), 'image_path' => url($publicPath . "staticPages/images/schools/commingsoonBig.jpg")], ['name' => 'Peace International School', 'location' => 'Kozhikode', 'address' => 'Peace International School 
                       Peace Mount 7/138C
                       Cheruvatta, Moozhikkal
                       Kozhikode - 32
                       0495-2812020
                       08891-313007
                       kozhikode@peaceschools.in', 'contact_person' => 'Mr. Akbar', 'short_description' => 'Every child is a gift from god, amanath. They should be brought up giving proper education and moral values to live in this society and to enjoy the prosperities of jannath.', 'long_description' => 'Every child is a gift from god, amanath. They should be brought up giving proper education and moral values to live in this society and to enjoy the prosperities of jannath.', 'thumbnail_path' => url($publicPath . "staticPages/images/schools/kozhikode.jpg"), 'image_path' => url($publicPath . "staticPages/images/schools/kozhikodeBig.jpg")], ['name' => 'Peace Public School', 'location' => 'Manjeri', 'address' => 'Peace Public School
                       Ernad Knowledge City
                       Cherukulam, Elankur PO
                       Manjeri
                       Malappuram 676122
                       0483-3013611
                       +91 95-26-500040
                       manjeri@peaceschools.in', 'contact_person' => 'Mr. Abdulla', 'short_description' => 'Peace school with its international existence and standard, provide quality education for the student all over the world.', 'long_description' => 'Peace school with its international existence and standard, provide quality education for the student all over the world.', 'thumbnail_path' => url($publicPath . "staticPages/images/schools/manjeri.jpg"), 'image_path' => url($publicPath . "staticPages/images/schools/manjeriBig.jpg")], ['name' => 'Peace Public School', 'location' => 'Vengara', 'address' => 'Peace Public School
                       Peace Village
                       Venkulam, Oorakam Keezhmuri
                       Vengara, Malappuram
                       +91 483-2836162
                       +91 8606-447600
                       vengara@peaceschools.in', 'contact_person' => 'Mr. Faisal', 'short_description' => 'Talents and abilities of every child is diversified. Peace school help the students to identify their interests and guide them to reach their destination.', 'long_description' => 'Talents and abilities of every child is diversified. Peace school help the students to identify their interests and guide them to reach their destination.', 'thumbnail_path' => url($publicPath . "staticPages/images/schools/vengara.jpg"), 'image_path' => url($publicPath . "staticPages/images/schools/vengaraBig.jpg")], ['name' => 'Peace Public School', 'location' => 'Kottakkal', 'address' => 'Peace Public School
                       Peace Mount
                       Puthoor PO
                       Kottakkal - 676553
                       0483-2744451
                       9656222272
                       kottakkal@peaceschools.in', 'contact_person' => 'Mr. Shihab', 'short_description' => 'Peace School is located at the heart of Kottakkal yet the school is separated from the crowd of town and the students are provided with pleasant atmosphere.', 'long_description' => 'Peace School is located at the heart of Kottakkal yet the school is separated from the crowd of town and the students are provided with pleasant atmosphere.', 'thumbnail_path' => url($publicPath . "staticPages/images/schools/kottakkal.jpg"), 'image_path' => url($publicPath . "staticPages/images/schools/kottakkalBig.jpg")], ['name' => 'Peace Public School', 'location' => 'Mathilakam', 'address' => 'Peace® Public School
                       Padiyoor PO, Irinjalakkud via, Mathilakam
                       Thrissur 680695
                       Ph: +91 94-47-146402
                       mathilakam@peaceschools.in', 'contact_person' => 'Mr. Haris', 'short_description' => 'Students should learn to defend themselves. To guide them peace school has well versed marshal artists to give coaching in marshal arts. They are not taught to fight but to defend there is our moral studies shows up its importance.', 'long_description' => 'Students should learn to defend themselves. To guide them peace school has well versed marshal artists to give coaching in marshal arts. They are not taught to fight but to defend there is our moral studies shows up its importance.', 'thumbnail_path' => url($publicPath . "staticPages/images/schools/mathilakam.jpg"), 'image_path' => url($publicPath . "staticPages/images/schools/mathilakamBig.jpg")], ['name' => 'Peace International School', 'location' => 'Ernakulam', 'address' => 'Peace® International School
                       33/2479A, CHAKKARAPARAMB, ERNAKULAM BYE-PASS, 
                       THAMMANAM P.O., COCHIN-682032
                       Ph: +91 484-6450111 ernakulam@peaceschools.in', 'contact_person' => 'Mr. Anfas', 'short_description' => 'Students experience an interactive learning process. Education is the process of making human personality through training its physical, emotional,intellectual ,imaginative as well as spiritual aspects.', 'long_description' => 'Students experience an interactive learning process. Education is the process of making human personality through training its physical, emotional,intellectual ,imaginative as well as spiritual aspects.', 'thumbnail_path' => url($publicPath . "staticPages/images/schools/ernakulam.jpg"), 'image_path' => url($publicPath . "staticPages/images/schools/ernakulamBig.jpg")], ['name' => 'Peace Public School', 'location' => 'Kollam', 'address' => 'Peace® Public School
                       Thrikovil Vattom, Near Kaniyam thodu, 
                       Mukhathala P.O., KOLLAM-691577
                       093-88-811131
                       kollam@peaceschools.in', 'contact_person' => 'Mr. Munnavir', 'short_description' => 'The need of Islamic thoughts and studies is increasing where the students are always attracted to false promises.', 'long_description' => 'The need of Islamic thoughts and studies is increasing where the students are always attracted to false promises.', 'thumbnail_path' => url($publicPath . "staticPages/images/schools/kollam.jpg"), 'image_path' => url($publicPath . "staticPages/images/schools/kollamBig.jpg")]);
     foreach ($schools as $index => $school) {
         App\Models\School::create($school);
     }
 }