public function save($id, CustomerSaveRequest $request) { $customer = $this->customerRepository->getById($id); if (!$customer) { $customer = new \App\Customer(); } $customer->fill($request->all()); \Auth::user()->customers()->save($customer); return $this->json->success('Customer Saved Successfully ...'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Requests\CreateCustomerRequest $response) { // $data = $response->all(); //dd ($data); $customers = new \App\Customer($data); //dd($customers); $customers->save(); return redirect('admin/customer'); }
public function postRegister(Request $request) { $this->validate($request, ['first_name' => 'required|min:3', 'last_name1' => 'required|min:3', 'last_name2' => 'required|min:3', 'email' => 'required|email', 'phone_number1' => 'required', 'phone_number2' => 'required']); $customer = new \App\Customer(); $customer->first_name = $request->first_name; $customer->last_name1 = $request->last_name1; $customer->last_name2 = $request->last_name2; $customer->email = $request->email; $customer->phone_number1 = $request->phone_number1; $customer->phone_number2 = $request->phone_number2; $customer->save(); \Session::flash('flash_message', 'Customer' . $customer->first_name . ' ' . $customer->last_name1 . ' ' . 'Registered'); return redirect('/'); }
public function postContact(Request $request) { $this->validate($request, ['first_name' => 'required|min:3', 'last_name1' => 'required|min:3', 'last_name2' => 'required|min:3', 'email' => 'required|email', 'phone_number1' => 'required', 'phone_number2' => 'required', 'message' => 'required']); $customer = new \App\Customer(); $customer->first_name = $request->first_name; $customer->last_name1 = $request->last_name1; $customer->last_name2 = $request->last_name2; $customer->email = $request->email; $customer->phone_number1 = $request->phone_number1; $customer->phone_number2 = $request->phone_number2; $customer->save(); Mail::send('emailView', ['request' => $request], function ($message) { $message->to('*****@*****.**', 'Rafael')->subject('message from customer'); }); return redirect('/'); }
public function index() { $orders = App\Order::all(); foreach ($orders as $order) { $customer = App\Customer::find($order->customer_id); echo $order->name . " Ordered by " . $order->customer->name . "<br/>"; } }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker::create('vi_VN'); for ($i = 0; $i < 100; $i++) { $name = $faker->name; $customer = App\Customer::create(['name' => $name, 'birthday' => $faker->date($format = 'Y-m-d', $max = '-18 years'), 'identity_card_number' => $faker->taxpayerIdentificationNumber, 'company' => $faker->company, 'phone_number' => $faker->phoneNumber, 'email' => $faker->email, 'description' => $faker->text, 'keywords' => $name, 'address' => $faker->address]); } }
public function run() { // Uncomment the below to wipe the table clean before populating DB::table('customers')->delete(); $faker = $this->getFaker(); for ($i = 0; $i < 100; $i++) { $name = $faker->name; $email = $faker->email; $password = Hash::make("password"); App\Customer::create(['email' => $email, 'password' => $password]); } }
| */ Route::get('/', function () { return view('welcome'); }); Route::get('home', function () { if (Auth::guest()) { return Redirect::to('auth/login'); } else { echo 'Welcome home!! ' . Auth::user()->email . '.'; } }); Route::get('user/{id}', function ($id) { $user = App\User::find($id); echo 'The user with ID of ' . $id . ' has an email of: ' . $user->email . '.'; }); // Authentication routes... Route::get('auth/login', 'Auth\\AuthController@getLogin'); Route::post('auth/login', 'Auth\\AuthController@postLogin'); Route::get('auth/logout', 'Auth\\AuthController@getLogout'); // Registration routes... Route::get('auth/register', 'Auth\\AuthController@getRegister'); Route::post('auth/register', 'Auth\\AuthController@postRegister'); Route::get('customer/{id}', 'CustomerController@show'); Route::get('get_customer', 'CustomerController@get_customer'); Route::get('orders', 'OrderController@index'); Route::get('mypage', function () { $customers = App\Customer::all(); $data = array('customers' => $customers); return view('mypage', $data); });
<?php /* |-------------------------------------------------------------------------- | Routes File |-------------------------------------------------------------------------- | | Here is where you will register all of the routes in an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/', function () { return view('welcome'); }); Route::get('customer', function () { $customer = App\Customer::find(1); echo 'Hello my name is ' . $customer->name; }); /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | This route group applies the "web" middleware group to every route | it contains. The "web" middleware group is defined in your HTTP | kernel and includes session state, CSRF protection, and more. | */
|-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/', ['middleware' => 'auth', 'uses' => 'CompanyController@index']); Route::model('company', 'Company'); Route::model('customer', 'Customer'); Route::model('driver', 'Driver'); Route::model('truck', 'Truck'); Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']); Route::bind('company', function ($value, $route) { return App\Company::whereId($value)->first(); }); Route::bind('customer', function ($value, $route) { return App\Customer::whereId($value)->first(); }); Route::bind('driver', function ($value, $route) { return App\Driver::whereId($value)->first(); }); Route::bind('truck', function ($value, $route) { return App\Truck::whereId($value)->first(); }); Route::resource('company', 'CompanyController'); Route::resource('customer', 'CustomerController'); Route::resource('driver', 'DriverController'); Route::resource('truck', 'TruckController');
#dd( \Gloudemans\Shoppingcart\Facades\Cart::content()); # dd(\Illuminate\Support\Facades\Session::all()); #\Illuminate\Support\Facades\Session::flush(); #dd(Cache::pull('order1')) #dd(\Illuminate\Support\Facades\Cache::get('user')); ?> {!!\Collective\Html\FormFacade::open(['file='=>true,'action'=>'TestController@test'])!!} {{--{!!\Collective\Html\FormFacade::file('image')!!}--}} {{--<input type="text" name="name" value=""/>--}} {{--<input type="text" name="role_id" value=""/>--}} {{--<input type="checkbox" name="cb"/>--}} <script src='https://www.google.com/recaptcha/api.js'></script> <div class="g-recaptcha" data-sitekey="6LdkCQoTAAAAALNT3hXvjB3fQXX9Rc1_zmyd4LyF"></div> <input type="submit" value="go"/> {!!\Collective\Html\FormFacade::close()!!} {{--</pre>--}} {{--@include('layout.frontend.head')--}} <?php $c = new \App\Artist(); $c->update(['talent' => 11]); $order = new \App\Order(); $t = $order->with('deliveryDetailOfCustomer')->where('id', 50)->get()->toArray(); dd($t); $cus = new \App\Customer(); $t = $cus->with('user')->get()->toArray(); dd(); ?> #$cd->render() {{--@include('layout.frontend.footer')--}}