· 8 years ago · Nov 23, 2017, 06:46 AM
1Schema::create('alunos', function (Blueprint $table) {
2 $table->integer('id_academia')->unsigned();
3 $table->increments('id_aluno');
4 $table->string('id_aluno_academia', 3);
5 $table->string('foto')->nullable();
6 $table->string('nome');
7 $table->string('email', 70);
8 $table->string('celular', 16);
9 $table->string('telefone', 16)->nullable();
10 $table->date('data_nasc');
11 $table->string('idade', 2);
12 $table->string('cpf', 14);
13 $table->string('rg', 12)->nullable();
14 $table->boolean('sexo');
15 $table->string('cep')->nullable();
16 $table->string('endereco');
17 $table->string('num_end');
18 $table->string('bairro');
19 $table->string('cidade', 50);
20 $table->string('uf', 2);
21 $table->string('plano', 1)->nullable();
22 $table->string('tipo_pagamento', 1)->nullable();
23 $table->string('turma', 3)->nullable();
24 $table->string('professor', 3)->nullable();
25 $table->string('senha')->nullable();
26 $table->string('status', 1)->default(0);
27 $table->date('expira')->nullable();
28 $table->boolean('acesso')->default(0);
29 $table->string('tipo_visita', 1)->nullable();
30 $table->string('indicado_por', 1)->nullable();
31 $table->string('modalidades_interesse')->nullable();
32 $table->string('nivel_interesse')->nullable();
33 $table->string('objetivo')->nullable();
34 $table->text('observacoes')->nullable();
35 $table->timestamps();
36 $table->foreign('id_academia')->references('id_academia')->on('academias')->onDelete('cascade');
37 });
38
39public function run()
40 {
41 $nomes =
42 [
43 'Felipe', 'João', 'Gabriela', 'Miguel', 'Renata', 'Juliana', 'Sintia', 'Marcos',
44 'Débora', 'Diego', 'Carlos', 'Fabiano', 'Maria', 'Jurema', 'Joaquim', 'Artur',
45 'Eduarda', 'Antonella', 'Julieta', 'Ema'
46 ];
47
48 $sobrenomes =
49 [
50 'Silva', 'Santos', 'Paz', 'Guedes', 'Silveira', 'Ribeiro', 'Magalhães', 'Garcia',
51 'Agostini', 'Goldmann', 'Schulz', 'Schmidt', 'Bellini'
52 ];
53
54 $ufs =
55 [
56 'AC','AL','AM','AP','BA','CE','DF','ES','GO','MA','MG','MS','MT',
57 'PA','PB','PE','PI','PR','RJ','RN','RO','RR','RS','SC','SE','SP','TO'
58 ];
59
60 $emails =
61 [
62 '@gmail.com', '@outlook.com', '@yahoo.com', '@uol.com.br', '@msn.com', '@bol.com.br'
63 ];
64
65 $alunos = [];
66
67 for ($i=1; $i < 2; $i++) {
68
69 for ($c=0; $c < 14; $c++) {
70 $cpf[$c] = rand(0,9);
71 }
72
73 for ($r=0; $r < 10; $r++) {
74 $rg[$r] = rand(0,9);
75 }
76
77 for ($n=0; $n < 3; $n++) {
78 $num[$n] = rand(0,9);
79 }
80
81 $dia = rand(1, 26);
82 $mes = rand(1, 12);
83 $ano = rand(2012, 2017);
84
85 $nome = $nomes[array_rand($nomes)];
86 $sobrenome = $sobrenomes[array_rand($sobrenomes)];
87 $email = strtolower($nome . '.' . $sobrenome).$emails[array_rand($emails)];
88
89 $expira = $ano . '-' . $mes . '-' . $dia;
90 $sexo = rand(0,1);
91
92 $alunos =
93 [
94 'id_academia' => rand(1, 10),
95 'id_aluno_academia' => $i,
96 'nome' => $nome.' '.$sobrenome,
97 'email' => $email,
98 'celular' => '(54) 9 9945-2428',
99 'data_nasc' => '1989-09-01',
100 'idade' => rand(18, 45),
101 'cpf' => implode('',$cpf),
102 'rg' => implode('', $rg),
103 'sexo' => $sexo,
104 'endereco' => 'Rua Maratona',
105 'num_end' => implode('', $num),
106 'bairro' => 'Vila Isabel',
107 'cidade' => 'Passo Fundo',
108 'uf' => $ufs[array_rand($ufs)],
109 'plano' => rand(1,4),
110 'senha' => md5(time())
111 ];
112
113 DB::table('alunos')->insert($alunos);
114 }
115 // $alunos->save();
116 }