本文整理汇总了PHP中Agent::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Agent::findOrFail方法的具体用法?PHP Agent::findOrFail怎么用?PHP Agent::findOrFail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent::findOrFail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store()
{
$prospect = new Prospect();
$fullAddress = Input::get('prospect-address');
$addressPieces = explode(", ", $fullAddress);
$prospect->prospect_address = $addressPieces[0];
$prospect->prospect_city = $addressPieces[1];
$prospect->prospect_state = $addressPieces[2];
$prospect->prospect_address_lat = Input::get('latitude');
$prospect->prospect_address_lng = Input::get('longitude');
$prospect->prospect_zip = Input::get('zipcode');
if (Input::has('prospect-unit-number')) {
$prospect->prospect_apt_unit = Input::get('prospect-unit-number');
}
$prospect->agent_id = Agent::findOrFail(1)->id;
//formula to determine agent
$prospect->broker_id = Broker::findOrFail(1)->id;
if ($prospect->save()) {
//true returns true or false
return Redirect::action('HomeController@edit', array('prospect' => $prospect->id));
} else {
Session::flash('errorMessage', 'Unable to locate property!');
return Redirect::back()->withInput();
}
}
示例2: update
/**
* Update the specified agent in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
dd('asdasd');
$agent = Agent::findOrFail($id);
$validator = Validator::make($data = Input::all(), Agent::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$agent->update($data);
return Redirect::route('control-panel.1agents.index');
}
示例3: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$agent = $this->agent->findOrFail($id);
return View::make('admin.agents.show', compact('agent'));
}