public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { $user_id = rand(1, 10); Bank::create(['name' => 'Bank ' . $faker->word($nb = 5), 'address' => $faker->address(), 'created_by' => $user_id, 'changed_by' => $user_id, 'change_reason' => $faker->realText(100)]); } }
/** * Store a newly created resource in storage. * POST /banks * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Bank::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $data['created_by'] = Auth::user()->id; $data['changed_by'] = Auth::user()->id; Bank::create($data); return Redirect::route('admin.banks.index'); }
function bank_create_form_submit($data) { $data['church_id'] = $_SESSION['log_church_id']; $data['date_created'] = date("Y-m-d"); $data['date_lastchange'] = date("Y-m-d"); $error = bank_validate($data); if (!empty($error)) { return FALSE; } $bank = new Bank(); $response = $bank->create($data); if ($response['id'] > 0) { return bank_list($response['id']); } else { return false; } }
public function run() { Bank::create(['name' => "Santander", 'company_id' => '1']); }