示例#1
0
 /**
  * Store a newly created branch in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), BBranch::$rules, BBranch::$messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $bbranch = new BBranch();
     $bbranch->bank_branch_name = Input::get('name');
     $bbranch->branch_code = Input::get('code');
     $bbranch->organization_id = '1';
     $bbranch->save();
     return Redirect::route('bank_branch.index');
 }
示例#2
0
文件: routes.php 项目: kenkode/xpose
Route::post('import/bankBranches', function () {
    if (Input::hasFile('bbranches')) {
        $destination = public_path() . '/migrations/';
        $filename = str_random(12);
        $ext = Input::file('bbranches')->getClientOriginalExtension();
        $file = $filename . '.' . $ext;
        Input::file('bbranches')->move($destination, $file);
        Excel::selectSheetsByIndex(0)->load(public_path() . '/migrations/' . $file, function ($reader) {
            $results = $reader->get();
            foreach ($results as $result) {
                $bbranch = new BBranch();
                $bbranch->branch_code = $result->branch_code;
                $bbranch->bank_branch_name = $result->branch_name;
                $bbranch->bank_id = $result->bank_id;
                $bbranch->organization_id = $result->organization_id;
                $bbranch->save();
            }
        });
    }
    return Redirect::back()->with('notice', 'bank branches have been succefully imported');
});
/* #################### IMPORT BANKS ################################## */
Route::post('import/banks', function () {
    if (Input::hasFile('banks')) {
        $destination = public_path() . '/migrations/';
        $filename = str_random(12);
        $ext = Input::file('banks')->getClientOriginalExtension();
        $file = $filename . '.' . $ext;
        Input::file('banks')->move($destination, $file);
        Excel::selectSheetsByIndex(0)->load(public_path() . '/migrations/' . $file, function ($reader) {
            $results = $reader->get();