public function create($id) { $cliente = Client::with('info')->where('id', '=', $id)->first(); $company = Company::with('managers')->where('id', '=', \Auth::guard('web_managers')->user()->company_id)->firstOrFail(); $config = json_decode($company->configuracoes); $tiposEvento = ArrayObjToArray($config->config->tipoEvento); return view('admin.orcamento.create', compact('cliente', 'config', 'tiposEvento', 'company')); }
public function alteraConfigs(Request $request) { $company = Company::find(\Auth::guard('web_managers')->user()->company_id); $company->configuracoes = $request->config; $configs = json_decode($company->configuracoes); Cookie::queue(Cookie::make('corPainel', $configs->config->cores, 2628000)); $company->save(); return 'true'; }
<?php /* |-------------------------------------------------------------------------- | Model Factories |-------------------------------------------------------------------------- | | 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(itEvento\User::class, function (Faker\Generator $faker) { return ['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt(str_random(10)), 'remember_token' => str_random(10)]; }); $factory->define(itEvento\Models\Company::class, function (Faker\Generator $faker) { return ['nome' => $faker->name, 'email' => $faker->email, 'telefone_fixo' => '(xx) 0000-0000']; }); $factory->define(itEvento\Models\Client::class, function (Faker\Generator $faker) { $company = rand(1, count(\itEvento\Models\Company::all())); return ['company_id' => $company, 'nome' => 'CP: ' . $company . ' - ' . $faker->name, 'email' => $faker->email, 'telefone_fixo' => '(xx) 0000-0000']; }); $factory->define(itEvento\Models\Orcamento::class, function (Faker\Generator $faker) { $company = 1; $randTipo = rand(1, 2); $tipos = ['Casamento', '15 anos', 'Formatura', 'Aniversário']; return ['company_id' => $company, 'client_id' => 1, 'nome' => $faker->name, 'data' => $faker->date($format = 'Y-m-d', $max = 'now'), 'local_cerimonia' => $faker->streetName, 'local_recepcao' => $faker->streetName, 'horario_cerimonia' => $faker->time($format = 'H:i', $max = 'now'), 'horario_recepcao' => $faker->time($format = 'H:i', $max = 'now'), 'local_recepcao' => $faker->address, 'tipo' => $tipos[$randTipo], 'numero_convidados' => $faker->numberBetween($min = 100, $max = 800)]; });
public function run() { Company::create(['nome' => 'Mais Bartenders', 'telefone_fixo' => '31 329605673', 'email' => '*****@*****.**']); Company::create(['nome' => 'Celebritá', 'telefone_fixo' => '31 3227-3204', 'email' => '*****@*****.**']); }