本文整理汇总了PHP中app\Profile::fill方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::fill方法的具体用法?PHP Profile::fill怎么用?PHP Profile::fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Profile
的用法示例。
在下文中一共展示了Profile::fill方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addUserPost
public function addUserPost()
{
$profile = Profile::where('no_gaji', Request::get('no_gaji'))->first();
if (!empty($profile)) {
Session::flash('error', 'Gagal. No gaji *' . Request::get('no_gaji') . '* bertindih.');
return Redirect::back()->withInput();
}
$no_anggota = Profile::where('no_anggota', Request::get('no_anggota'))->first();
if (!empty($no_anggota)) {
Session::flash('error', 'Gagal. No anggota *' . Request::get('no_anggota') . '* bertindih.');
return Redirect::back()->withInput();
}
$nokp = Profile::where('nokp', Request::get('nokp'))->first();
if (!empty($nokp)) {
Session::flash('error', 'Gagal. No KP *' . Request::get('nokp') . '* telah wujud, dengan No Gaji *' . $nokp->no_gaji . '*.');
return Redirect::back()->withInput();
}
$validation = Validator::make(Request::all(), ['no_anggota' => 'required|numeric', 'no_gaji' => 'required|numeric', 'profile_category_id' => 'required|numeric', 'nama' => 'required', 'nokp' => 'required', 'jantina_id' => 'required', 'bangsa' => 'required', 'jumlah_yuran_bulanan' => 'required|numeric', 'zon_gaji_id' => 'required|numeric']);
if ($validation->fails()) {
Session::flash('error', 'Sila isikan ruangan dengan format yang betul');
return Redirect::back()->withInput()->withErrors($validation);
}
$profile = new Profile();
$profile->fill(Request::all());
$profile->jumlah_yuran_bulanan = Request::get('jumlah_yuran_bulanan');
$profile->nama = strtoupper(Request::get('nama'));
$profile->tarikh_ahli = Carbon::now();
$profile->jantina_id = Request::get('jantina_id');
$profile->alamat1 = strtoupper(Request::get('alamat1'));
$profile->alamat2 = strtoupper(Request::get('alamat2'));
$profile->jawatan = strtoupper(Request::get('jawatan'));
$profile->email = strtoupper(Request::get('email'));
$profile->taraf_jawatan = strtoupper(Request::get('taraf_jawatan'));
if ($profile->save()) {
Session::flash('success', 'Berjaya. Anggota baru telah didaftarkan');
} else {
Session::flash('error', 'Gagal. Anggota baru gagal didaftarkan');
}
return Redirect::route('members.profiles.addUser');
}