/** * Run the database seeds. * * @return void */ public function run() { DB::table('clients')->truncate(); //insert some dummy records Client::create(['name' => 'Idea7', 'country' => 'IN', 'status' => 'active']); Client::create(['name' => 'Sunpharma', 'country' => 'IN', 'status' => 'active']); }
public function store(Request $request) { $this->validate($request, ['name' => 'required', 'birth' => 'required', 'address' => 'required', 'phone' => 'required']); $request['created_at'] = Carbon::now(); Client::create($request->all()); return view('client.new')->with('success', 'Cliente cadastrado com sucesso!'); }
public function handleAction(Request $request) { $action = $request->input('_action'); if ($action == 'createClient') { //Creation : Client::create($request->all()); // FLash messaging : flash()->success('Opération réussie!', 'Client créé avec succès.'); } else { if ($_POST['_action'] == 'getClientByID') { $id = $_POST['_uid']; $client = Client::where('id', $id)->with('files')->first(); return response(['status' => 'success', 'client' => $client], 200); } else { if ($_POST['_action'] == 'editClient') { $id = $_POST['id']; $client = Client::find($id); $client->lastname = $_POST['lastname']; $client->firstname = $_POST['firstname']; $client->email = $_POST['email']; $client->street = $_POST['street']; $client->postal_code = $_POST['postal_code']; $client->city = $_POST['city']; $client->vat = $_POST['tva']; $client->mobile = $_POST['mobile']; $client->office = $_POST['office']; $client->fax = $_POST['fax']; $client->save(); flash()->success('Opération réussie!', 'Client modifé avec succès.'); } else { } } } return redirect('/clients'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $input = Input::all(); $this->validate($request, ['Name' => 'required|string', 'PhoneNo' => 'required|digits:11', 'Address' => 'required', 'Email' => 'email']); Client::create($input); return Redirect::route('clients.index')->with('message', 'Client created'); }
public function run() { $client = Client::create(['name' => 'Exhibit Partners', 'address' => '7700 68th Ave N', 'city' => 'Minneapolis', 'state' => 'MN', 'zip' => '55428']); User::create(['name' => 'Bill Gench', 'email' => '*****@*****.**', 'client_id' => $client->id, 'password' => bcrypt('trms'), 'is_admin' => true]); User::create(['name' => 'Seth Phillips', 'email' => '*****@*****.**', 'client_id' => $client->id, 'password' => bcrypt('trms'), 'is_admin' => true]); User::create(['name' => 'Debs Holloway', 'email' => '*****@*****.**', 'client_id' => $client->id, 'password' => bcrypt('trms'), 'is_admin' => true]); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $this->validate($request, ['name' => 'required|string|max:255', 'tax_number' => 'string|max:255|unique:clients', 'street' => 'string|max:255', 'city' => 'string|max:255', 'postal_code' => 'integer']); $client = Client::create(['name' => $request->get('name'), 'tax_number' => $request->get('tax_number'), 'street' => $request->get('street'), 'city' => $request->get('city'), 'postal_code' => $request->get('postal_code')]); flash()->success('Client created!'); return redirect()->route('clients.index'); }
public function store(ClientRequest $request) { Client::create($request->all()); //AFTER the row is added, get the last record to pass to the next page. $client = Client::latest()->first(); \Session::flash('flash_message', 'Client ' . $client->first_name . ' ' . $client->last_name . ' was created.'); return redirect('clients'); }
/** * create client * @param Request $request * @return \Illuminate\Http\JsonResponse */ public function create(Request $request) { //validation $this->validation($request); //insert client $client = Client::create(['name' => $request->get('name'), 'gender' => $request->get('gender')]); return response()->json(['id' => $client->id]); }
public function store(Request $request) { $currentPage = 'cocinas'; $pedido = new KitchenRequest($request->input('pedido')); $pedido->secciones = $request->input('secciones'); Client::create($request->input('cliente'))->kitchenRequests()->save($pedido); return view('pages.cocinasCreate', ['posted' => true] + compact('currentPage')); }
public function store(StoreColdRoomRequest $request) { $cliente = $request->input('cliente'); $pedido = $request->input('pedido'); $currentPage = 'cuartos'; Client::create($cliente)->coldRoomRequests()->create($pedido); return view('pages.cuartosCreate', ['posted' => true] + compact('currentPage')); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $clientRequest) { $this->validate($clientRequest, ['first_name' => 'required', 'last_name' => 'required', 'company_name' => 'required', 'email' => 'required', 'address' => '', 'zipcode' => '', 'city' => '', 'primary_number' => '', 'secondary_number' => '', 'industry' => '', 'company_type' => '', 'fk_user_id' => 'required']); $input = $clientRequest->all(); Client::create($input); //dd($input); Session::flash('flash_message', 'Client successfully added!'); return redirect()->route('clients.index'); }
/** * Store a newly created resource in storage. * POST: /client. * * @return Response */ public function store(Request $request) { $this->validate($request, ['name' => 'required', 'email' => 'required|email', 'website' => 'url']); $input = $request->all(); $client = Client::create($input); $client->save(); Session::flash('success', 'Client successfully added.'); return Redirect::route('client.index'); }
/** * Handle the command. * * @param CreateClientUserCommand $command * @return void */ public function handle(CreateClientUserCommand $command) { //If photo uploaded correctly //Create user and client in DB DB::transaction(function () use($command) { $user = User::create(['email' => $command->email, 'password' => $command->password]); $client = Client::create(['profile_photo' => $command->profile_photo, 'first_name' => $command->first_name, 'last_name' => $command->last_name, 'user_id' => $user->id, 'email' => $command->email, 'phone_1' => $command->phone_1, 'phone_2' => $command->phone_2, 'address_1' => $command->address_1, 'address_2' => $command->address_2, 'city' => $command->city, 'state' => $command->state, 'zip' => $command->zip]); }); }
function create() { $client = array('name' => Input::get('ad'), 'last_name' => Input::get('soyad'), 'email' => Input::get('email'), 'tel' => Input::get('tel'), 'app_date' => Input::get('randevuTarihi'), 'hour_id' => Input::get('saat'), 'message' => Input::get('mesaj')); $create = Client::create($client); if ($create) { $_SESSION['mesaj'] = '<div class="form-signin" style="background-color:pink;"><center><p style="color:green;">Bilgileriniz alındı en yakın zamanda size döneceğiz.</p></center></div>'; } else { $_SESSION['mesaj'] = '<div class="form-signin" style="background-color:pink;"><center><p style="color:green;">Hata Oluştu.</p></center></div>'; } return Redirect::to('e-randevu'); }
public function store(ClientRequest $request) { if (Auth::check()) { $userId = Auth::user()->id; } $client = Client::create(['name' => $request['name'], 'creator_user_id' => $userId]); $userOrganisationRole = UserOrganisationRole::find($userId); $organisationClient = OrganisationsClients::create(['organisation_id' => $userOrganisationRole->organisation_id, 'client_id' => $client->id]); $organisationClient->clients()->save($client); return redirect('clients/create'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Requests\ClientsRequest $request) { //Almacenar los datos de un cliente $client = $request->all(); $nombre = $request->input('name'); $email = $request->input('email'); Mail::send('email.correoPrueba', ['nombre' => $nombre], function ($message) use($email) { $message->to($email)->subject('Hola'); }); /*$client->save();*/ Client::create($client); return redirect('/'); }
/** * Inserts new entry into Client Table and * checks for validation on form submission * Authorization is checked for privilages * * @param CreateClientRequest $request * @return Response */ public function store(ClientRequest $request) { $input = $request->all(); $client = Client::create($input); $program = Program::where('id', '=', $request->input('programs'))->first(); $agent = Auth::user(); $client->program()->associate($program); $client->agent()->associate($agent); $client->save(); $temp = Temp::where('fname', '=', $request->fname)->where('lname', '=', $request->lname)->first(); if ($temp != null) { $temp->delete(); } $meal = new Meal(); $meal->date_fed = date('Y-m-d'); $meal->client()->associate($client); $meal->breakfast = 0; $meal->lunch = 0; $meal->dinner = 0; $meal->save(); return redirect('client'); }
/** * Store a newly created client in storage. * * @return Response */ public function store(Request $request) { $validator = Validator::make($request->all(), ['email' => 'required|unique:clientes|max:255|email']); if ($validator->fails()) { $this->sys_notifications[] = array('type' => 'danger', 'message' => $validator->errors()->first()); $request->session()->flash('sys_notifications', $this->sys_notifications); return back()->withErrors($validator)->withInput($request->all()); } $data = $request->all(); $data['owner_id'] = $request->user()->id; // Create a new Client $client = Client::create($data); if ($client) { $this->sys_notifications[] = array('type' => 'success', 'message' => 'Novo cliente adicionado com sucesso!'); $request->session()->flash('sys_notifications', $this->sys_notifications); return redirect('/clientes/' . $client->id); } else { $this->sys_notifications[] = array('type' => 'danger', 'message' => 'Não foi possível criar o cliente!'); $request->session()->flash('sys_notifications', $this->sys_notifications); return back()->withErrors($validator)->withInput($request->all()); } }
public function store(AnswerRequest $request) { $client = Client::create(); //Was macht hier das ->all(); $questionData = $request->all(); foreach ($questionData["radio_question"] as $question => $value) { $answer = new Answer(); $answer->question_id = $question; $answer->answer = $value; $answer->client_id = $client->id; //Unterschied zwischen ->save und ::create $answer->save(); } //Kann man das irgendwie sauberer lösen als mit dieser foreach Schleife, damit es DRY-Kompatibel ist? foreach ($questionData["text_question"] as $question => $value) { $answer = new Answer(); $answer->question_id = $question; $answer->comment = $value; $answer->client_id = $client->id; //Unterschied zwischen ->save und ::create $answer->save(); } }
/** * Function that creates a new client. * * @return Response */ public function createClient() { // Validate Input. $validator = Validator::make(Input::all(), array('name' => 'required', 'id' => 'required', 'phone' => 'required', 'address' => 'required', 'lat' => 'required', 'lon' => 'required')); if ($validator->fails()) { return response()->json(['error' => 'No se envio la informacion completa!']); } // Check that user is part of authorized staff. if (Auth::user()->Type != 1) { // If they are unauthorized no point in returning anything. return response()->json(['state' => 'Unauthorized']); } // Save location. $location = Location::create(array('Name' => 'Direccion de ' . Input::get('name'), 'Latitude' => Input::get('lat'), 'Longitude' => Input::get('lon'), 'Type' => 2)); // Get the credit value. $credit = Input::get('credit') ? true : false; $creditLimit = Input::get('creditLimit'); // Reset creditLimit just in case. if (!$credit) { $creditLimit = 0; } // Now save it. Client::create(array('Name' => Input::get('name'), 'Cedula' => Input::get('id'), 'Phone' => Input::get('phone'), 'Email' => Input::get('email'), 'Address' => Input::get('address'), 'InstitutionId' => Input::get('institutionId'), 'Credit' => $credit, 'CreditLimit' => $creditLimit, 'LocationId' => $location->Id)); return response()->json(['state' => 'Success']); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return Client */ protected function create(array $data) { return Client::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }
public function store(ClientesRequest $request) { Client::create(array_except($request->all(), '_token')); return Redirect('home'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Requests\CreateClientRequest $request) { Client::create(Request::all()); flash()->success('Success', 'Your client has been created.'); return redirect('/clients'); }
/** * Store a new client */ public function store(ClientRequest $request) { $client = Client::create($request->all()); flash()->success('Created!', $client->name . ' has been created.'); return back(); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $client = Client::create($request->all()); $client->series()->attach($request->input('seriesList')); return redirect('client'); }
public function store(Request $request) { $this->validate($request, ['name' => 'required|string|max:255']); $client = Client::create(['name' => $request->get('name')]); return $client->toArray(); }
/** * Create new client. * * @param CreateClientRequest $request * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response */ public function create(CreateClientRequest $request) { $response = new AjaxResponse(); // Check if client already exists if (DB::table('clients')->where('name', $request->get('name'))->where('user_id', Auth::user()->id)->count()) { $response->setFailMessage(trans('clients.client_exists')); return response($response->get(), $response->getDefaultErrorResponseCode()); } $client = Client::create(['name' => $request->get('client_name'), 'email' => $request->get('client_email'), 'phone_number' => $request->get('client_phone_number'), 'user_id' => Auth::user()->id]); $response->setSuccessMessage(trans('clients.client_added')); return response($response->get()); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { Client::create($request->all()); Session::flash('flash_message', 'Client added!'); return redirect('admin/client'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(ClientRequest $request) { $client = Client::create($request->all()); return redirect()->route('admin.clients.index')->with('message', "{$client->name} created"); }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { return Client::create($request->all()); }