SHARE
TWEET

Untitled

fadlyshafa May 25th, 2020 1,045 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. namespace App\Http\Controllers;
  4.  
  5. use Illuminate\Http\Request;
  6.  
  7. use App\Models\Customers;
  8.  
  9. class Customer_controller extends Controller
  10. {
  11.     public function add(){
  12.         $title = 'Add Customer';
  13.  
  14.         return view('customer.add',compact('title'));
  15.     }
  16.  
  17.     public function store(Request $request){
  18.         $data['nama'] = $request->nama;
  19.         $data['no_telp'] = $request->no_telp;
  20.         $data['email'] = $request->email;
  21.         $data['alamat'] = $request->alamat;
  22.  
  23.         $file = $request->file('photo_profile');
  24.         $nama_file = $file->getClientOriginalName();
  25.         $file->move('pp_image',$nama_file);
  26.         $data['photo_profile'] = 'pp_image/'.$nama_file;
  27.  
  28.         $file = $request->file('photo_ktp');
  29.         $nama_file = $file->getClientOriginalName();
  30.         $file->move('ktp_image',$nama_file);
  31.         $data['photo_ktp'] = 'ktp_image/'.$nama_file;
  32.  
  33.         $data['created_at'] = date('Y-m-d H:i:s');
  34.         $data['updated_at'] = date('Y-m-d H:i:s');
  35.  
  36.         Customers::insert($data);
  37.         \Session::flash('sukses','Data berhasil ditambah');
  38.  
  39.         return redirect('customers/add');
  40.     }
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top