public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Branch::create(['name' => $faker->city, 'address' => $faker->address]); } }
/** * Store a newly created branch in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Branch::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } Branch::create($data); return Redirect::route('branches.index'); }
public function createBranch() { $branch = Branch::create(array('strBrchID' => Input::get('brnchID'), 'strBrchName' => Input::get('brnchName'), 'strBrchAddress' => Input::get('brnchAdd'))); $branch->save(); return Redirect::to('/branches'); }
public static function Create($branch) { return Branch::create(array('name' => $branch->name, 'address' => $branch->address, 'telephone' => $branch->telephone)); }
public function postNewCampus2() { //verify the user input and create account $validator = Validator::make(Input::all(), array('College' => 'required|exists:institutions,id', 'Campus' => 'required|max:200')); if ($validator->fails()) { return Redirect::route('newcampus-get')->withErrors($validator)->withInput()->with('global', 'Sorry!! College details were not posted, please retry.'); } else { $collegeid = Input::get('College'); $campus = Input::get('Campus'); //save college to the database //store the user details $branch = Branch::create(array('user_id' => Auth::user()->id, 'institutions_id' => $collegeid, 'name' => $campus)); if ($branch) { //load success page if (Auth::user()) { return Redirect::route('member-home')->with('global', 'Congratulations!! Your College has been added successfully.<br/><a href="http://www.squeeber.com/newcampus" >Add another</a>'); } else { return Redirect::route('home')->with('global', 'Congratulations!! Your College has been added successfully.<br/><a href="http://www.squeeber.com/newcampus" >Add another</a>'); } } return Redirect::route('newcampus-get')->withInput()->with('global', 'Sorry!! Campus details were not posted, please retry.'); } }