/
proc
/
self
/
cwd
/
cropnet
/
app
/
Http
/
Controllers
/
Upload File
HOME
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\support\Facades\DB; class TestController extends Controller { public function generateHash() { \App::setLocale('hi'); return view('test.generate-hash'); } public function generateHashPost(Request $request) { $validator = \Validator::make($request->all(), array( 'password' => 'required|string' )); if($validator->fails()) { return redirect('generate-hash') ->withErrors($validator) ->withInput(); } else { $password_hash = \Hash::make($request->password); return redirect('generate-hash')->with(['password_hash'=>$password_hash]); } } public function upload() { //echo '<h1>:) </h1><h3>stop stop, first check excel columns and tabel columns, if all right then comment dd and enjoy the data uploading through Comma Seperated Values...</h3>'; // dd('thankyou :)'); // dd('thankyou :)'); //dd('thankyou :)'); $row = 1; if (($handle = fopen("t.csv", "r")) !== FALSE) { while (($data = fgetcsv($handle, 4000, ",")) !== FALSE) { //dd($data); $num = count($data); //$test = \DB::table("membership_details")->where('form_no', $data[0])->update(array("fee_receipt_no"=>$data[1], "fee_receipt_date"=>$data[2])); //$test = \DB::table("membership_details")->where('bank_account_no', $data[1])->delete(); // $test = \DB::table("legacy_data")->where('aadhar_no', $data[0])->where('is_active', 1)->update(['is_active' => 0]); // if ($test) { // echo $data[0]; // } else { // echo $row; // } $last_id = DB::table('users')->insertGetId(array( 'name' => $data['0'], 'email' => $data['1'], )); //dd('uploaded...'); // \DB::table('old_member_detail')->insert([ // 'aadhar_no' => $data[0] // ]); // exit; // dd($data); $row++; //echo 'uploaded...'; } } } }