本文整理汇总了PHP中Branch::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Branch::create方法的具体用法?PHP Branch::create怎么用?PHP Branch::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Branch
的用法示例。
在下文中一共展示了Branch::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Branch::create(['name' => $faker->city, 'address' => $faker->address]);
}
}
示例2: store
/**
* 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');
}
示例3: createBranch
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');
}
示例4: Create
public static function Create($branch)
{
return Branch::create(array('name' => $branch->name, 'address' => $branch->address, 'telephone' => $branch->telephone));
}
示例5: postNewCampus2
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.');
}
}