本文整理汇总了PHP中app\Branch::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Branch::create方法的具体用法?PHP Branch::create怎么用?PHP Branch::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Branch
的用法示例。
在下文中一共展示了Branch::create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
$this->validate($request, ['name' => 'required|max:255', 'mobile' => 'numeric|min:10', 'telephone' => 'numeric']);
$input = $request->all();
$input['company_id'] = Auth::user()->company->id;
$input['account_year_id'] = session('account');
Branch::create($input);
flash()->success('Branch Created Successfully !');
return redirect('branch');
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$validator = Validator::make([$request->all(), 'nom_branche' => $request->nom_branche, 'code_branche' => $request->code_branche], ['nom_branche' => 'required', 'code_branche' => 'required'], ['nom_branche.required' => "le nom de la branche est requis", 'code_branche.required' => "le Code de la branche est requis"]);
if ($validator->passes()) {
Branch::create(['nom_branche' => $request->nom_branche, 'code_branche' => $request->code_branche, 'user_id' => \Auth::user()->id]);
return redirect()->action('StatisticsController@gestion')->with('success', 'Informations bien enregistrées');
} else {
return redirect()->back()->withErrors($validator);
}
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
if (Auth::user()->role === 'superadmin' && Auth::user()->email === 'nlnazmul@gmail.com') {
$input = $request->all();
Branch::create($input);
return redirect('branch');
} else {
return redirect('auth/login');
}
}
示例4: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//
\App\Branch::create(['name' => 'denpasar', 'city' => 'denpasar', 'province' => 'bali', 'country' => 'indonesia']);
\App\Branch::create(['name' => 'surabaya', 'city' => 'surabaya', 'province' => 'jawatimur', 'country' => 'indonesia']);
}