本文整理匯總了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']);
}