public function store() { // validate // read more on validation at http://laravel.com/docs/validation $rules = array('full_name' => 'required', 'name' => 'required', 'inn' => 'required', 'kpp' => 'required|size:9', 'ogrn' => 'required|unique:clients|size:13'); $validator = Validator::make(Input::all(), $rules); // process the login if ($validator->fails()) { return redirect()->back()->with('danger', 'Данные клиента введены неверно')->withInput(); } else { if (count(Client::where('inn', '=', Input::get('inn'))->get()) > 0) { return redirect()->back()->with('danger', 'Клиент с данным ИНН уже имеется в базе')->withInput(); } else { var_dump($this->is_valid_inn((int) Input::get('inn'))); if ($this->is_valid_inn((int) Input::get('inn'))) { //Проверка инн $client = new Client(); $client->full_name = Input::get('full_name'); $client->name = Input::get('name'); $client->inn = Input::get('inn'); $client->kpp = Input::get('kpp'); $client->ogrn = Input::get('ogrn'); $client->save(); // redirect //*Request::flashOnly('message', 'Клиент добавлен');*/ Session::flash('success', 'Клиент добавлен'); return Redirect::to('client/' . $client->id . '/agreement'); } else { return redirect()->back()->with('danger', 'ИНН введен не верно')->withInput(); } } } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(ClientRequest $request) { $Client = new Client($request->all()); $Client->save(); Flash::success('Se ha creado a ' . $Client->nombre . ', como cliente.'); return redirect()->route('clientes.index'); }
/** * Handle creation of new bill. * * @param CreateBillRequest $request * @return array */ public function create(CreateBillRequest $request) { // Save request data $clientName = $request->get('client'); $useCurrentCampaign = $request->get('use_current_campaign'); $campaignYear = $request->get('campaign_year'); $campaignNumber = $request->get('campaign_number'); $client = DB::table('clients')->where('name', $clientName)->where('user_id', Auth::user()->id)->first(); // Create new client if not exists if (!$client) { $client = new Client(); $client->user_id = Auth::user()->id; $client->name = $clientName; $client->save(); } // Create new bill $bill = new Bill(); $bill->client_id = $client->id; $bill->user_id = Auth::user()->id; $campaign = Campaigns::current(); // Check if current campaign should be used if (!$useCurrentCampaign) { $campaign = Campaign::where('year', $campaignYear)->where('number', $campaignNumber)->first(); } $bill->campaign_id = $campaign->id; $bill->campaign_order = Campaigns::autoDetermineOrderNumber($campaign, $client->id); $bill->save(); event(new UserCreatedNewBill(Auth::user()->id, $bill->id)); // Return response $response = new AjaxResponse(); $response->setSuccessMessage(trans('bills.bill_created')); return response($response->get()); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * * @return \Illuminate\Http\Response */ public function store(Request $request) { // $client = new Client(); $client->name = $request->name; $client->save(); }
public function submitOTP(Request $request) { //get mobile number from user input $mobileNum = $request->input('mobile'); //get user type from user input $userType = $request->input('userType'); //set user email $userEmail = '*****@*****.**'; //set country code $countryCode = 61; //initial authentication API // $authy_api = new AuthyApi(config('services.authy.key')); $authy_api = new AuthyApi(config('services.authy.key'), 'http://sandbox-api.authy.com'); //sandbox //register a user through email, cellphone, country_code $user = $authy_api->registerUser($userEmail, $mobileNum, $countryCode); //generate authentication token and send it to usser $sms = $authy_api->requestSms($user->id(), array("force" => "true")); if ($sms->ok()) { //check user exist or not $results = Client::where('mobile', $mobileNum)->first(); //if user does not exist, register of him if (empty($results)) { $newUser = new Client(); $newUser->mobile = $mobileNum; $newUser->save(); } return view('auth.otp')->with('userid', $user->id())->with('mobileNum', $mobileNum)->with('userType', $userType); } else { //session()->put('message','incorrect mobile number'); return redirect('login')->with('message', 'Please input correct mobile number'); } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(ClientRequest $request) { // $user = new User(); $user->email = $request->email; $user->nama = $request->name_pt; $user->password = Hash::make($request->password); $user->type = "client"; $user->status = "active"; $user->save(); $client = new Client(); $client->nama_pt = $request->name_pt; $client->pic = $request->pic; $client->alamat = $request->address; $client->no_telepon = $request->phone; $client->id_user = $user->id_user; $client->lat = $request->lat; $client->long = $request->long; $client->save(); foreach ($request->support as $item) { $cs = new ClientSupport(); $cs->id_client = $client->id_client; $cs->id_support = $item; $cs->save(); } Session::flash("success", "Success add client"); return redirect()->route('client'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $client = new Client(); $client->name = Str::title(Input::get('name')); $client->hours = $client->amount = 0; $client->save(); return redirect()->action('ClientController@show', $client->id); }
/** * Store a newly created resource in storage. * * @param StoreAddClientPostRequest $request * @return Response */ public function store(StoreaddClientPostRequest $request) { $person = new Client(array('name' => $request->name, 'user_id' => Auth::user()->id, 'nationality' => $request->nationality, 'email' => $request->email, 'idNumber' => $request->idNumber, 'phoneNo' => $request->phoneNo, 'role' => 'owner')); $person->save(); Session::put('ClientInsertedId', $person->id); Session::put('AddRole', 'owner'); Session::flash('flash_message', 'Owner successfully added! Need to add the Address'); return redirect('bankDetail/create'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $client = new Client($request->input()); $client->public_id = str_random(8); $client->user_id = Auth::user()->id; $client->status = "active"; $client->save(); return redirect('clients/' . $client->id); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { if (\Input::get('id')) { $client = Client::find(\Input::get('id')); $client->fill(\Input::all()); } else { $client = new Client(\Input::all()); } if ($client->save()) { return $client; } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(User $user, Request $request) { $data = $request->only('name', 'email', 'address', 'phone'); $client = new Client(); $client->user_id = $user->id; $client->name = $data['name']; $client->email = $data['email']; $client->phone = $data['phone']; $client->address = $data['address']; $client->save(); return response(['msg' => 'client was added'], 201); }
public function testClientSave() { $client = new Client(); $client->name = 'Idea7'; $client->country = 'IN'; $client->status = 'active'; if (!$client->save()) { $errors = $client->getErrors()->all(); echo 'Client Insert failed' . print_r($errors); $this->assertTrue(false); } else { $this->assertTrue(true); } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function postClient(Request $request) { $this->validate($request, ['name' => 'required', 'image' => 'required']); $client = new Client(); $client->name = $request->name; $imageName = time() . '.' . $request->image->getClientOriginalExtension(); $imagePath = public_path('/uploads/' . $imageName); $imageResize = \Image::make(\Input::file('image'))->resize(175, 130)->save($imagePath); $client->image = $imageName; $client->link = $request->link; $client->save(); Session::flash('message', 'Successfully Stored your Data!'); return redirect()->back(); }
public function postRegistrar(Request $request) { $validator = Validator::make($request->all(), ['name' => 'required|max:70', 'ruc' => 'required|numeric|digits:11', 'phone' => 'min:6|numeric', 'email' => 'email']); if ($validator->fails()) { return redirect('clientes')->withInput()->withErrors($validator); } $client = new Client(); $client->name = $request->name; $client->ruc = $request->ruc; $client->address = $request->address; $client->phone = $request->phone; $client->email = $request->email; $client->save(); return redirect('clientes'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $validator = Validator::make($request->all(), ['name' => 'required', 'country' => 'required']); if ($validator->fails()) { return Redirect::to('clients/create')->withErrors($validator)->withInput(); } // store $client = new Client(); $client->name = $request->input('name'); $client->country = $request->input('country'); $client->status = 'active'; $client->save(); Session::flash('message', 'Client Successfully created!'); return redirect('clients'); }
/** * Show the form for creating a new resource. * GET /clients/create * * @return Response */ public function create() { $pTitle = "Clients"; $name = Input::get('name'); $user_id = Auth::id(); // Validation $validator = Validator::make(array('name' => $name), array('name' => 'required|unique:clients')); if ($validator->fails()) { return Redirect::back()->withErrors($validator); } $client = new Client(); $client->name = $name; $client->user_id = $user_id; $client->save(); return Redirect::back()->with('success', $name . " is now a new client."); }
/** * Save a new client to the database * * @param ClientRequest $request The incoming request. * * @return Response */ public function store(ClientRequest $request) { $client = new Client(); $client->active = (int) $request->active; $client->name = $request->name; $client->contactName = $request->contactName; $client->contactEmail = $request->contactEmail; $client->address1 = $request->address1; $client->address2 = $request->address2; $client->city = $request->city; $client->locality = $request->locality; $client->postalCode = $request->postalCode; $client->phone = $request->phone; $client->user()->associate($request->user()); $client->save(); $userMessage = $this->successMessage('client'); return redirect()->route('client.show', [$client->id])->with('userMessage', $userMessage); }
public function store() { $rules = array('name' => 'required', 'country' => 'required', 'state' => 'required', 'city' => 'required', 'zip' => 'required', 'address' => 'required', 'contact' => 'required', 'phone' => 'required', 'email' => 'required|email', 'website' => 'url'); $validator = Validator::make(Request::all(), $rules); if ($validator->passes()) { $store = new Client(); $store->fill(Request::all()); $store->save(); // Reload Table Data $data_client = array('client' => Client::orderBy('id', 'desc')->get(), 'refresh' => true); return view('clients.table')->with($data_client); } else { if (Request::ajax()) { return view('clients.create')->withErrors($validator)->withInput(Request::all()); } return 0; } }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { $validator = Validator::make($request->all(), ['raison_sociale' => 'required|max:50', 'numero_siret' => 'required|min:14|max:14', 'adresse_1' => 'required|max:38', 'adresse_2' => 'max:38', 'adresse_3' => 'max:38', 'code_postal' => 'required|min:5|max:5', 'ville' => 'required|max:50', 'email' => 'required|email', 'tel' => 'min:10|max:50', 'fax' => 'min:10|max:50']); if ($validator->fails()) { return Redirect::to('client/create')->withErrors($validator->errors())->withInput(); } else { $client = new Client(); $client->num_cli = 'CL00' . date('-Y-m-') . strtoupper(substr(Input::get('raison_sociale'), 0, 5)); $client->rs_cli = Input::get('raison_sociale'); $client->adr1_cli = Input::get('adresse_1'); $client->adr2_cli = Input::get('adresse_2'); $client->adr3_cli = Input::get('adresse_3'); $client->cp_cli = Input::get('code_postal'); $client->ville_cli = Input::get('ville'); $client->mail_cli = Input::get('email'); $client->tel_cli = Input::get('tel'); $client->fax_cli = Input::get('fax'); $client->save(); return Redirect::to('client'); } }
public function addClients(Request $request) { $validator = Validator::make($request->all(), ['amount' => 'required|numeric']); if ($validator->fails()) { return redirect()->back()->withInput($request->all())->withErrors($validator); } //add new client $client = new Client(); //afwachtend $client->FK_client_status_id = '1'; $input = $request->all(); //alle input requesten //aantal klanten $client->amount = $input['amount']; //FK uit input field $client->FK_table_id = $input['FK_table_id']; //entertime = nu $client->enterTime = Carbon::now('Europe/Brussels'); $client->save(); return redirect()->back()->withSuccess('Klant succesvol toegevoegd.'); }
public function store(Request $request) { $datedoc = Carbon::now(-6); $yr = $datedoc->year; $mo = $datedoc->month; $dom = $datedoc->day; $doy = $datedoc->dayOfYear; $dateadmission = $request->input('dateadmission'); if (!empty($dateadmission) || $dateadmission == '0000-00-00') { $dateparts = explode('-', $dateadmission); $partyear = $dateparts[0]; $partmonth = $dateparts[1]; $partdom = $dateparts[2]; $dateadmission = Carbon::createFromDate($partyear, $partmonth, $partdom, -6); //return redirect()->back()->with('status',"Date Admission is $dateadmission"); } else { //uh oh, we dont have an admission date. return redirect()->back()->with('status', 'You must specifcy an admission date!'); } if (Auth::check()) { $staff_id = Auth::user()->id; $sfname = Auth::user()->fname; $slname = Auth::user()->lname; } else { return redirect('auth/login'); } $program_id = $request->input('program_id'); $inquiry_id = $request->input('inquiry_id'); $inquiry = Inquiry::find($inquiry_id); if (is_null($inquiry)) { return redirect()->back()->with('status', 'You must have a valid Inquiry'); } //$existingmrn = $inquiry->mrn; $episode_id = $inquiry->episode_id; $client_id = $inquiry->client_id; if (is_null($client_id)) { $client_id = 0; } $currentmrn = $inquiry->mrn; $fname = $inquiry->fname; $lname = $inquiry->lname; $mi = $inquiry->mi; $dob = $inquiry->dob; //=========close previous admissions since you cant have more than one at a time $clearresult = DB::table('admissions')->where('inquiry_id', '=', $inquiry_id)->update(['status_id' => '13', 'status' => 'Discharged', 'dctype_id' => '19', 'dctype' => 'Pending Review', 'datedischarge' => $datedoc]); //=================================== $status = "Admitted"; $status_id = 12; $dctype_id = 18; $dctype = "Not Applicable"; $program_id = $request->input('program_id'); if (is_null($program_id)) { return redirect()->back()->with('status', 'You are missing a valid program id'); } $serviceref = Service::find($program_id); $program = $serviceref->service; $admission = new Admission(); $looper = 0; $vals = array($inquiry_id, $client_id, $episode_id); $flds = array('inquiry_id', 'client_id', 'episode_id'); foreach ($flds as $fld) { $admission->setAttribute($fld, Input::has($fld) ? $vals[$looper] : '0'); $looper++; } //======================= $morechks = array('eie', 'dss'); foreach ($morechks as $morechk) { $admission->setAttribute($morechk, Input::has($morechk) ? true : false); } $admission->mo = $mo; $admission->doy = $doy; $admission->dom = $dom; $admission->yr = $yr; $admission->fname = $fname; //$request->input('fname'); $admission->lname = $lname; //$request->input('lname'); $admission->mi = $mi; $admission->sfname = $sfname; $admission->sfname = $sfname; $admission->slname = $slname; $admission->staff_id = $staff_id; $admission->datedoc = $dateadmission; $admission->dateadmission = $dateadmission; //$request->input('dateadmission'); $admission->datedischarge = $request->input('datedischarge'); $admission->program_id = $request->input('program_id'); $admission->program = $program; $admission->status_id = $status_id; //$request->input('status_id'); $admission->status = $status; $admission->dctype_id = $dctype_id; //$request->input('dctype_id'); $admission->dctype = $dctype; $admission->save(); $admission_id = $admission->id; //====== assign mrn ======/ //$mymsg = "yr: $yr mo: $mo dom: $dom "; //return redirect()->back()->with('status',$mymsg); //first we need to check for previous admissions - not including this one. $numadmissions = DB::table('admissions')->where('eie', '!=', '1')->whereNotIn('id', [$admission_id])->where('inquiry_id', '=', $inquiry_id)->count(); //get the current number of admissions so far this month. $admissionsmtd = DB::table('admissions')->where('eie', '!=', '1')->whereNotIn('id', [$admission_id])->where('mo', '=', $mo)->where('yr', '=', $yr)->count(); $admissionsmtd = $admissionsmtd + 1; //$admissionsmtd = 777; $totlength = 7; //======= heres the split where former clients get one set of things and new clients another. //============================================================ if ($numadmissions < 1) { //then its a brand spanking new admission and we need to generate an mrn and a new client_id //====== $molength = strlen($mo); //check to see if its a two digit or one digit if ($molength == 1) { //if it has only one digit then pad it by one zero. $newmo = str_pad($mo, 2, "0", STR_PAD_LEFT); } //next we get the maxadmission id $admissionsmtdlength = strlen($admissionsmtd); $padlength = $totlength - $admissionsmtdlength; $padlength = abs($padlength); //make sure it isnt a negative number $newnum = str_pad($admissionsmtd, $padlength, "0", STR_PAD_LEFT); $yrend = substr("{$yr}", -2); //get the last two numbers $newmrn = $yrend . "-" . $newmo . $newnum; //$mymsg = "mrn: $newmrn "; //return redirect()->back()->with('status',$mymsg); $client = new Client(); $client->fname = $fname; $client->lname = $lname; $client->datedoc = $dateadmission; //$client->dob = $dob; $client->isalias = 0; $client->eie = 0; $client->dss = 0; $client->sfname = $sfname; $client->slname = $slname; $client->staff_id = $staff_id; $client->inquiry_id = $inquiry_id; $client->episode_id = $episode_id; $client->mrn = $newmrn; $client->save(); $client_id = $client->id; //we probably need the dob in here somewhere too. $updateresult = DB::table('admissions')->where('inquiry_id', '=', $inquiry_id)->where('id', '=', $admission_id)->update(['mrn' => $newmrn, 'client_id' => $client_id]); $updateresult2 = DB::table('inquiries')->where('id', '=', $inquiry_id)->update(['mrn' => $newmrn, 'client_id' => $client_id]); $mrn = new Mrn(); $mrn->mrn = $newmrn; $mrn->datedoc = $dateadmission; $mrn->eie = 0; $mrn->fname = $fname; $mrn->lname = $lname; $mrn->client_id = $client_id; $mrn->inquiry_id = $inquiry_id; $mrn->episode_id = $episode_id; $mrn->save(); $mrnumber = $newmrn; //=================== } else { $inquiry = Inquiry::find($inquiry_id); if (is_null($inquiry)) { return redirect()->back()->with('status', 'You must have a valid Inquiry'); } $existingmrn = $inquiry->mrn; $episode_id = $inquiry->episode_id; $client_id = $inquiry->client_id; $mrnumber = $inquiry->mrn; //we need to update the client table with the last admission information //$updateresult = DB::table('admissions')->where('inquiry_id','=',$inquiry_id) // ->where('id','=',$admission_id) // ->update(['mrn' => $newmrn,'client_id'=>$client_id]); } //this is where we update all existing records with the client_id. //ideally we would get the names of the tables that need to be updated //from those identified through the mfl. that way we don't have to hope //to keep track of what will be completed during inquiry and updated later. // for our purposes right now, we are just going to list them. $tables = array("assessments", "admissions", "demographics", "ice", "payors"); foreach ($tables as $table) { $updatedone = DB::table($table)->where('inquiry_id', '=', $inquiry_id)->update(['mrn' => $mrnumber, 'client_id' => $client_id]); } //if($client_id > 0) // { // //return redirect()->route('clientview', $client_id); // } else { return redirect()->route('inquiryview', $inquiry_id); // } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Requests\CreateClientRequest $request) { $input = Request::all(); $client = new Client(); $client->name = $input['name']; $client->customer_id = $input['customer_id']; $client->telephone_number = $input['telephone_number']; $client->address = $input['address']; $client->email = $input['email']; $client->tin = $input['tin']; $client->contact_person = $input['contact_person']; $client->accounting_contact_person = $input['accounting_contact_person']; $client->accounting_email = $input['accounting_email']; $client->credit_limit = $input['credit_limit']; $client->status = $input['status']; $client->payment_terms = $input['payment_terms']; $client->vat_exempt = $input['vat_exempt']; $client->user_id = $input['user_id']; $client->save(); return redirect()->action('ClientsController@index'); }
public function run() { Model::unguard(); $faker = Faker::create('pt_BR'); $faker->addProvider(new \Faker\Provider\pt_BR\Person($faker)); $faker->addProvider(new \Faker\Provider\pt_BR\Address($faker)); // $faker->addProvider(new \Faker\Provider\en_US\Address($faker)); // $faker->addProvider(new \Faker\Provider\en_US\PhoneNumber($faker)); // $faker->addProvider(new \Faker\Provider\en_US\Company($faker)); $faker->addProvider(new \Faker\Provider\Lorem($faker)); $faker->addProvider(new \Faker\Provider\Internet($faker)); /* CREATE FAKE USERS */ foreach (range(1, 2) as $index) { $user = User::create(['username' => $index == 1 ? env('ADMIN_USERNAME', 'tonetlds') : $faker->userName(), 'name' => $index == 1 ? env('ADMIN_NAME', 'Luciano') : $faker->firstName(), 'email' => $index == 1 ? env('ADMIN_EMAIL', '*****@*****.**') : $faker->email(), 'password' => $index == 1 ? Hash::make(env('ADMIN_PASSWORD', '1234')) : Hash::make('1234')]); echo "______________________________________________________________________________________"; echo "\n"; echo "User " . $index . ": #" . $user->id . " " . $user->name . ""; echo "\n"; /* Clients for each user */ foreach (range(1, 3) as $index_client) { $empresa = $faker->company(); $client = new Client(); $client->name = $empresa; $client->responsavel = $faker->firstName() . " " . $faker->lastName(); $client->email = $faker->email(); $client->email2 = $faker->email(); $client->phones = $faker->phoneNumber() . ", " . $faker->phoneNumber(); $client->company = $empresa; $client->address = $faker->streetAddress(); $client->city = $faker->city(); $client->cep = $faker->postcode(); $client->obs = $faker->sentence($nbWords = 6, $variableNbWords = true); $slug = $client->slug; $client->slug = $slug; $client->owner_id = $user->id; $client->save(); echo "Cliente " . $client->name; echo "\n"; /* CONTACTS */ foreach (range(1, 3) as $index) { Contact::create(['name' => $faker->firstName() . " " . $faker->lastName(), 'email' => $faker->email(), 'address' => $faker->streetAddress(), 'company' => $faker->company(), 'client_id' => $client->id, 'owner_id' => $user->id]); } /* PROJECTS */ foreach (range(1, 3) as $index_project) { $project = Project::create(['title' => $index . '-' . $faker->stateAbbr(), 'description' => $faker->company(), 'status' => '', 'date' => $faker->dateTimeBetween($startDate = '-1 years', $endDate = 'now'), 'client_id' => $client->id, 'owner_id' => $user->id]); echo "Criado projeto " . $project->id . " para " . $client->name . " (user: "******")"; echo "\n"; /* DISCIPLINAS */ foreach (range(1, 3) as $index_discipline) { $items = ['Estrutura Metálica', 'Concreto', 'Instalações de Ar Condicionado', 'Segurança']; $disciplines = ProjectDiscipline::create(['title' => $items[$index_discipline - 1], 'description' => $faker->sentence($nbWords = 6), 'project_id' => $project->id, 'owner_id' => $user->id]); echo "Disciplina " . $disciplines->title; echo "\n"; } /* ETAPAS */ foreach (range(1, 3) as $index_stage) { $items = ['Geral', '1A', '1B', '2A']; $projectstage = ProjectStage::create(['title' => $index_stage . ' ' . $items[$index_stage - 1], 'status' => 'Em andamento', 'description' => $faker->company(), 'project_id' => $project->id, 'owner_id' => $user->id]); echo "Etapa " . $projectstage->title; echo "\n"; /* CONSULTAS TÉCNICAS */ foreach (range(1, 3) as $index_consults) { $tc_types = array(0, 1, 2); $tc_type = $tc_types[array_rand($tc_types)]; $tc_rating = array(1, 2, 3); $color = new Alfred(); $consult = TechnicalConsult::create(['title' => 'Consulta teste ' . $index_consults . ' Projeto ' . $project->id . ' Etapa ' . $projectstage->id, 'description' => $faker->company(), 'cliente_id' => $project->client->id, 'project_id' => $project->id, 'project_stage_id' => $projectstage->id, 'color' => $color->randomColor(), 'owner_id' => $user->id]); echo "Consulta tecnica '" . $consult->title . "' com 3 emails"; echo "\n"; /* EMAILS */ $subjects = 'Consulta sobre ' . $faker->sentence($nbWords = 2); $email_message = EmailMessage::create(['type' => 1, 'from' => $client->email, 'to' => '*****@*****.**', 'subject' => $subjects, 'body_text' => 'Texto do corpo do email', 'body_html' => '<strong>Teste</strong> de e-mail em <i>html</i> enviado para ' . $client->email . ' em ' . $consult->created_at . '.', 'headers' => '', 'consulta_tecnica_id' => $consult->id, 'email_message_id' => null, 'owner_id' => $user->id, 'status' => null, 'date' => $faker->dateTimeThisYear($max = 'now'), 'rating' => $tc_rating[array_rand($tc_rating)]]); echo "E-mail enviado para <" . $email_message->to . ">"; echo "\n"; $email_message = EmailMessage::create(['type' => 2, 'from' => '*****@*****.**', 'to' => $client->email, 'subject' => 'RE: ' . $subjects, 'body_text' => 'Texto do corpo do segundo email', 'body_html' => '<strong>Título</strong><p>Segundo E-mail em html enviado para ' . $client->email . '.</p>', 'headers' => '', 'consulta_tecnica_id' => $consult->id, 'email_message_id' => $email_message->id, 'owner_id' => $user->id, 'status' => null, 'date' => $faker->dateTimeThisYear($max = 'now'), 'rating' => $tc_rating[array_rand($tc_rating)]]); echo "E-mail enviado para <" . $email_message->to . ">"; echo "\n"; $email_message = EmailMessage::create(['type' => $tc_type, 'from' => '*****@*****.**', 'to' => $client->email, 'subject' => 'RE: ' . $subjects, 'body_text' => 'Texto do corpo do segundo email', 'body_html' => '<strong>Título</strong><p>Segundo E-mail em html enviado para ' . $client->email . '.</p>', 'headers' => '', 'consulta_tecnica_id' => $consult->id, 'email_message_id' => $email_message->id, 'owner_id' => $user->id, 'status' => null, 'date' => $faker->dateTimeThisYear($max = 'now'), 'rating' => $tc_rating[array_rand($tc_rating)]]); echo "E-mail enviado para <" . $email_message->to . ">"; echo "\n"; } } } } } }
public function store(Request $request) { $personal_photo = \Input::file('personal_photo'); $tphoto1_1 = \Input::file('tphoto1_1'); $tphoto2_1 = \Input::file('tphoto2_1'); $tphoto3_1 = \Input::file('tphoto3_1'); $tphoto1_2 = \Input::file('tphoto1_2'); $tphoto2_2 = \Input::file('tphoto2_2'); $tphoto3_2 = \Input::file('tphoto3_2'); $tphoto1_3 = \Input::file('tphoto1_3'); $tphoto2_3 = \Input::file('tphoto2_3'); $tphoto3_3 = \Input::file('tphoto3_3'); if ($personal_photo != null) { $size = $personal_photo->getClientSize(); if ($size <= 0 || $size > $personal_photo->getMaxFilesize() || $this->check($personal_photo)) { return view('error'); } } if ($tphoto1_1 != null) { $size = $tphoto1_1->getClientSize(); if ($size <= 0 || $size > $tphoto1_1->getMaxFilesize() || $this->check($tphoto1_1)) { return view('error'); } } if ($tphoto2_1 != null) { $size = $tphoto2_1->getClientSize(); if ($size <= 0 || $size > $tphoto2_1->getMaxFilesize() || $this->check($tphoto2_1)) { return view('error'); } } if ($tphoto3_1 != null) { $size = $tphoto3_1->getClientSize(); if ($size <= 0 || $size > $tphoto3_1->getMaxFilesize() || $this->check($tphoto3_1)) { return view('error'); } } if ($tphoto1_2 != null) { $size = $tphoto1_2->getClientSize(); if ($size <= 0 || $size > $tphoto1_2->getMaxFilesize() || $this->check($tphoto1_2)) { return view('error'); } } if ($tphoto2_2 != null) { $size = $tphoto2_2->getClientSize(); if ($size <= 0 || $size > $tphoto2_2->getMaxFilesize() || $this->check($tphoto2_2)) { return view('error'); } } if ($tphoto3_2 != null) { $size = $tphoto3_2->getClientSize(); if ($size <= 0 || $size > $tphoto3_2->getMaxFilesize() || $this->check($tphoto3_2)) { return view('error'); } } if ($tphoto1_3 != null) { $size = $tphoto1_3->getClientSize(); if ($size <= 0 || $size > $tphoto1_3->getMaxFilesize() || $this->check($tphoto1_3)) { return view('error'); } } if ($tphoto2_3 != null) { $size = $tphoto2_3->getClientSize(); if ($size <= 0 || $size > $tphoto2_3->getMaxFilesize() || $this->check($tphoto2_3)) { return view('error'); } } if ($tphoto3_3 != null) { $size = $tphoto3_3->getClientSize(); if ($size <= 0 || $size > $tphoto3_3->getMaxFilesize() || $this->check($tphoto3_3)) { return view('error'); } } $email = $_POST['email']; $destinationPath = 'files'; $clients = new \App\Client(); $clients->fname = $_POST['fname']; $clients->lname = $_POST['lname']; $clients->nname = $_POST['nname']; $clients->email = $_POST['email']; $clients->city = $_POST['city']; $clients->state = $_POST['state']; $clients->zipcode = $_POST['zipcode']; $clients->gender = $_POST['gender']; $clients->phone_number = $_POST['phoneNum']; $clients->dob = $_POST['dob']; $clients->self_introduction = $_POST['self']; $clients->status = $_POST['status']; if ($personal_photo != null) { $name = ''; $extension = $personal_photo->getClientOriginalName(); $name .= $email; $name .= '_personal_photo_'; $name .= $extension; $name = str_replace("@", "_", $name); $personal_photo->move($destinationPath, $name); $clients->personal_photo = $destinationPath . '\\'; $clients->personal_photo .= $name; } $clients->save(); if ($_POST['category1'] != null) { $talent = new \App\Talent(); $talent->category = $_POST['category1']; $talent->specific_talent = $_POST['specific_talent1']; $talent->client_id = $clients->id; $talent->save(); $audiolink = $_POST['audiolink1']; $videolink = $_POST['videolink1']; $portfolio = new \App\Portfolio(); $portfolio->talent_id = $talent->id; if ($audiolink != null) { $portfolio->audio .= $audiolink; } if ($videolink != null) { $portfolio->video .= $videolink; } if ($tphoto1_1 != null) { $this->save_pic($portfolio, '_tphoto1_1_', $destinationPath, $tphoto1_1, $email); } if ($tphoto1_2 != null) { $this->save_pic($portfolio, '_tphoto1_2_', $destinationPath, $tphoto1_2, $email); } if ($tphoto1_3 != null) { $this->save_pic($portfolio, '_tphoto1_3_', $destinationPath, $tphoto1_3, $email); } $portfolio->photo = substr($portfolio->photo, 0, strlen($portfolio->photo) - 1); $portfolio->save(); } if ($_POST['category2'] != null) { $talent = new \App\Talent(); $talent->category = $_POST['category2']; $talent->specific_talent = $_POST['specific_talent2']; $talent->client_id = $clients->id; $talent->save(); $audiolink = $_POST['audiolink2']; $videolink = $_POST['videolink2']; $portfolio = new \App\Portfolio(); $portfolio->talent_id = $talent->id; if ($audiolink != null) { $portfolio->audio .= $audiolink; } if ($videolink != null) { $portfolio->video .= $videolink; } if ($tphoto2_1 != null) { $this->save_pic($portfolio, '_tphoto2_1_', $destinationPath, $tphoto2_1, $email); } if ($tphoto2_2 != null) { $this->save_pic($portfolio, '_tphoto2_2_', $destinationPath, $tphoto2_2, $email); } if ($tphoto2_3 != null) { $this->save_pic($portfolio, '_tphoto2_3_', $destinationPath, $tphoto2_3, $email); } $portfolio->photo = substr($portfolio->photo, 0, strlen($portfolio->photo) - 1); $portfolio->save(); } if ($_POST['category3'] != null) { $talent = new \App\Talent(); $talent->category = $_POST['category3']; $talent->specific_talent = $_POST['specific_talent3']; $talent->client_id = $clients->id; $talent->save(); $audiolink = $_POST['audiolink3']; $videolink = $_POST['videolink3']; $portfolio = new \App\Portfolio(); $portfolio->talent_id = $talent->id; if ($audiolink != null) { $portfolio->audio .= $audiolink; } if ($videolink != null) { $portfolio->video .= $videolink; } if ($tphoto3_1 != null) { $this->save_pic($portfolio, '_tphoto3_1_', $destinationPath, $tphoto3_1, $email); } if ($tphoto3_2 != null) { $this->save_pic($portfolio, '_tphoto3_2_', $destinationPath, $tphoto3_2, $email); } if ($tphoto3_3 != null) { $this->save_pic($portfolio, '_tphoto3_3_', $destinationPath, $tphoto3_3, $email); } $portfolio->photo = substr($portfolio->photo, 0, strlen($portfolio->photo) - 1); $portfolio->save(); } $desire = new \App\Servicedesire(); $desire->client_id = $clients->id; for ($i = 0; $i < sizeof($_POST['representation']); $i++) { if ($_POST['representation'][$i] != null) { $desire->representation .= $_POST['representation'][$i]; if ($i < sizeof($_POST['representation']) - 1) { $desire->representation .= ';'; } } } for ($i = 0; $i < sizeof($_POST['opportunity']); $i++) { if ($_POST['opportunity'][$i] != null) { $desire->opportunity .= $_POST['opportunity'][$i]; if ($i < sizeof($_POST['opportunity']) - 1) { $desire->opportunity .= ';'; } } } for ($i = 0; $i < sizeof($_POST['service']); $i++) { if ($_POST['service'][$i] != null) { $desire->service .= $_POST['service'][$i]; if ($i < sizeof($_POST['service']) - 1) { $desire->service .= ';'; } } } $desire->save(); $option = new \App\Option(); $option->client_id = $clients->id; $option->describeword1 = $_POST['describeword1']; $option->describeword2 = $_POST['describeword2']; $option->describeword3 = $_POST['describeword3']; $option->intro_video = $_POST['introVideo']; $option->presonal_website = $_POST['personalWebsite']; $option->social_media = $_POST['socialMedia']; $option->accolades = $_POST['accolades']; $option->current_representation = $_POST['current_representation']; $option->experiences = $_POST['experience']; $option->anything = $_POST['anything']; $option->save(); $subject = 'Thanks for your interest in Talentscool'; $message = 'Hi there,' . "\r\n" . "\r\n" . 'Thank you for your interest in Talentscool! Our aim is to connect you to opportunities and service providers for your career.' . "\r\n" . "\r\n" . 'We have received your application and will be reviewing it shortly. A member of our team will be in contact with you as your application proceeds. ' . "\r\n" . "\r\n" . 'Thank you,' . "\r\n" . 'Talentscool Team'; $headers = 'From: donotreply@talentscool.com' . "\r\n" . 'Reply-To: donotreply@talentscool.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $flag = mail($email, $subject, $message, $headers); if ($flag) { return view('thanks'); } }
*******************************************************************************************************************/ Route::get('delete_data', function () { \Artisan::call('migrate:refresh'); return; }); /** * creating records */ Route::get('create_data', function () { /******************************************************************************************************************* * client insert(s) *******************************************************************************************************************/ if (is_null($client = Client::checkIfExists('Kendra Scott'))) { $client = new Client(); $client->name = 'Kendra Scott'; $client->save(); } /******************************************************************************************************************* * project insert(s) ******************************************************************************************************************/ if (is_null($project = Project::checkIfExists('Magento Development'))) { // get $client->id $client = Client::where('name', '=', 'Kendra Scott')->first(); $project = new Project(); $project->name = 'Magento Development'; $project->client_id = $client->id; $project->flag_recording_time_for = true; $project->save(); } /******************************************************************************************************************* * work_type insert(s)