本文整理汇总了PHP中Supplier::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Supplier::where方法的具体用法?PHP Supplier::where怎么用?PHP Supplier::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Supplier
的用法示例。
在下文中一共展示了Supplier::where方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
* POST /supplier
*
* @return Response
*/
public function store()
{
$validator = Validator::make(Input::all(), Supplier::$rules);
if ($validator->fails()) {
return Redirect::to('supplier')->withErrors($validator)->withInput(Input::all());
} else {
if (Supplier::where('id_supp', '=', Input::get('id_supp'))->exists()) {
$supplier = Supplier::find(Input::get('id_supp'));
$supplier->nm_supp = Input::get('nm_supp');
$supplier->alamat = Input::get('alamat');
$supplier->telp = Input::get('telp');
$supplier->fax = Input::get('fax');
$supplier->save();
Session::flash('message', 'Successfully updated supplier!');
return Redirect::to('supplier');
} else {
$supplier = new Supplier();
$supplier->id_supp = Input::get('id_supp');
$supplier->nm_supp = Input::get('nm_supp');
$supplier->alamat = Input::get('alamat');
$supplier->telp = Input::get('telp');
$supplier->fax = Input::get('fax');
$supplier->save();
Session::flash('message', 'Successfully created supplier!');
return Redirect::to('supplier');
}
}
}
示例2: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update()
{
$input = Input::all();
$id = $input['rowId'];
$data = array('supp_name' => $input['editSupName'], 'supp_type' => $input['editSupType'], 'supp_add' => $input['editSupAdd'], 'email' => $input['editSupEmail'], 'contact_f' => $input['editSupPhone'], 'contact_s' => $input['editSupPhone2'], 'supp_mgm' => $input['editSupMgm']);
$update = Supplier::where('id', '=', $id)->update($data);
if ($update) {
return json_encode(array('error' => 0, 'success' => 1));
} else {
return json_encode(array('error' => 1, 'success' => 0));
}
}
示例3: getIndex
public function getIndex()
{
$edate = Supplierformdate::where('event', '=', Session::get('event'))->first();
$currdate = strtotime(date('Y-m-d'));
$evdate = strtotime($edate->opendate);
$diff = abs(($currdate - $evdate) / (60 * 60 * 24));
//dd($diff);
if ($currdate >= $evdate) {
$userdetails = array('name' => Auth::user()->name, 'event' => Auth::user()->event);
$suppliers = Supplier::where('event', '=', Session::get('event'))->with(array('supplierranks' => function ($query) {
$query->where('userid', '=', Session::get('userid'));
}))->get();
// $suppliers = Supplier::where('event','=',Session::get('event'))->with('supplierranks')->get()->sortBy('order');
// $suppliers = Supplier::all()->sortBy('order');
return View::make('rankingform.rankingform')->with(array('userdetails' => $userdetails, 'suppliers' => $suppliers));
} else {
$opendate = date('d-M-Y', $evdate);
return View::make('rankingform.rankingformnotavailable')->with('opendate', $opendate);
}
}
示例4: fire
//.........这里部分代码省略.........
$email_prefix = $first_name . '.' . $email_last_name;
} elseif ($this->option('email_format') == 'firstname') {
$email_last_name .= str_replace(' ', '', $last_name);
$email_prefix = $first_name;
}
}
$user_username = $email_prefix;
// Generate an email based on their name if no email address is given
if ($user_email == '') {
if ($first_name == 'Unknown') {
$status_id = 7;
}
$email = strtolower($email_prefix) . '@' . $this->option('domain');
$user_email = str_replace("'", '', $email);
}
}
$this->comment('Full Name: ' . $user_name);
$this->comment('First Name: ' . $first_name);
$this->comment('Last Name: ' . $last_name);
$this->comment('Username: ' . $user_username);
$this->comment('Email: ' . $user_email);
$this->comment('License Name: ' . $user_license_name);
$this->comment('Serial No: ' . $user_license_serial);
$this->comment('Licensed To Name: ' . $user_licensed_to_name);
$this->comment('Licensed To Email: ' . $user_licensed_to_email);
$this->comment('Seats: ' . $user_license_seats);
$this->comment('Reassignable: ' . $user_license_reassignable);
$this->comment('Supplier: ' . $user_license_supplier);
$this->comment('Maintained: ' . $user_license_maintained);
$this->comment('Notes: ' . $user_license_notes);
$this->comment('Purchase Date: ' . $user_license_purchase_date);
$this->comment('------------- Action Summary ----------------');
if ($user_username != '') {
if ($user = User::where('username', $user_username)->whereNotNull('username')->first()) {
$this->comment('User ' . $user_username . ' already exists');
} else {
// Create the user
$user = Sentry::createUser(array('first_name' => $first_name, 'last_name' => $last_name, 'email' => $user_email, 'username' => $user_username, 'password' => substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 10), 'activated' => true, 'permissions' => array('admin' => 0, 'user' => 1), 'notes' => 'User importerd through license importer'));
// Find the group using the group id
$userGroup = Sentry::findGroupById(3);
// Assign the group to the user
$user->addGroup($userGroup);
$this->comment('User ' . $first_name . ' created');
}
} else {
$user = new User();
$user->user_id = NULL;
}
// Check for the supplier match and create it if it doesn't exist
if ($supplier = Supplier::where('name', $user_license_supplier)->first()) {
$this->comment('Supplier ' . $user_license_supplier . ' already exists');
} else {
$supplier = new Supplier();
$supplier->name = e($user_license_supplier);
$supplier->user_id = 1;
if ($supplier->save()) {
$this->comment('Supplier ' . $user_license_supplier . ' was created');
} else {
$this->comment('Something went wrong! Supplier ' . $user_license_supplier . ' was NOT created');
}
}
// Add the license
$license = new License();
$license->name = e($user_license_name);
if ($user_license_purchase_date != '') {
$license->purchase_date = $user_license_purchase_date;
示例5: getUploadsuppliers
public function getUploadsuppliers()
{
$event = Session::get('uploadsupplierevent');
$evedate = Supplierformdate::where('event', '=', $event)->first();
return View::make('admin.uploadsuppliers')->with(array('suppliers' => Supplier::where('event', '=', $event)->get(), 'evedate' => $evedate));
}
示例6: suppliers
public function suppliers()
{
$term = \Input::get('term');
$suppliers = Supplier::where('supplier_name', 'like', "%{$term}%")->get()->lists('supplier_name', 'id');
return response()->json($suppliers);
}