本文整理汇总了PHP中Domain::whereUserId方法的典型用法代码示例。如果您正苦于以下问题:PHP Domain::whereUserId方法的具体用法?PHP Domain::whereUserId怎么用?PHP Domain::whereUserId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Domain
的用法示例。
在下文中一共展示了Domain::whereUserId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postOnlinephonelist
/**
* Display a listing of the resource.
*
* @return Response
*/
public function postOnlinephonelist()
{
$token = Input::only('token');
$user_id = $this->_getUserId($token['token']);
$online_phone = [];
if ($user_id) {
$status = $this->_getUserStatus($user_id);
if ($status == 2) {
//$online_phone = OnlinePhone::all();
} elseif ($status == 3) {
$domain = Domain::whereUserId($user_id)->get(array('sip_server'));
$sip_server = array();
foreach ($domain as $row) {
$sip_server[] = $row['sip_server'];
}
if ($sip_server) {
$online_phone = OnlinePhone::whereIn('sip_server', $sip_server)->get();
} else {
$online_phone = [];
}
$error = array(0, "");
} else {
//$sip_server = Domain::whereUserId($user_id)->first()->sip_server;
//$online_phone = OnlinePhone::whereSipServer($sip_server)->get();
}
} else {
$error = array(403, "Invalid Token");
}
return View::make('api.onlinephonelist')->with('online_phone', $online_phone)->with('error', $error);
}
示例2: getIndex
/**
* Display a listing of the resource.
*
* @return Response
*/
public function getIndex()
{
$status = Auth::user()->status;
if ($status == 2) {
$online_phone = OnlinePhone::all();
} elseif ($status == 3) {
$domain = Domain::whereUserId(Auth::user()->id)->get(array('sip_server'));
$sip_server = array();
foreach ($domain as $row) {
$sip_server[] = $row['sip_server'];
}
if ($sip_server) {
$online_phone = OnlinePhone::whereIn('sip_server', $sip_server)->get();
} else {
$online_phone = [];
}
} else {
$sip_server = Domain::find(Cookie::get('domain_hash'))->sip_server;
$online_phone = OnlinePhone::whereSipServer($sip_server)->get();
}
return View::make('online_phone.index')->with('online_phones', $online_phone);
}
示例3: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$user = User::find($id);
$profile = Profile::find($user->profile_id);
$user->delete();
$profile->delete();
if ($user->domain_id == NULL) {
$domain = Domain::whereUserId($id)->first();
if ($domain) {
$domain->delete();
$subuser = User::whereDomainId($domain->id)->first();
$subuser->delete();
PhoneNumber::whereUserId($subuser->id)->delete();
}
}
Event::fire('logger', array(array('account_remove', array('id' => $id, 'username' => $user->username), 2)));
$path = Request::segment(4) ? 'domain/users/' . Request::segment(4) : 'users';
$path = $user->domain_id ? $path : "managers";
return Output::push(array('path' => $path, 'messages' => array('success' => _('User has been deleted'))));
}
示例4: getFilter
public function getFilter()
{
$status = Auth::user()->status;
if ($status == 2) {
$call_detail_report = Cdr::all();
$condq = "created is not null";
} elseif ($status == 3) {
$domain = Domain::whereUserId(Auth::user()->id)->get(array('sip_server'));
$sip_server = array();
foreach ($domain as $row) {
$sip_server[] = $row['sip_server'];
}
if ($sip_server) {
$call_detail_report = $this->_orWhereIn('caller_domain', 'callee_domain', $sip_server);
} else {
$call_detail_report = [];
}
$condq = $this->_orGenerator('caller_domain', 'callee_domain', $sip_server);
} else {
$sip_server = Domain::find(Cookie::get('domain_hash'))->whereDomain(Request::getHttpHost())->get(array('sip_server'));
$domainc = array();
foreach ($sip_server as $row) {
$domainc[] = $row['sip_server'];
}
$extension_arr = PhoneNumber::whereUserId(Auth::user()->id)->get(array('extension'));
$extension = array();
foreach ($extension_arr as $row) {
$extension[] = $row['extension'];
}
$call_detail_report = $this->_orWhereInAnd('src_uri', 'dst_uri', $extension, 'caller_domain', 'callee_domain', $domainc);
$condq = $this->_orGeneratorAnd('src_uri', 'dst_uri', $extension, 'caller_domain', 'callee_domain', $domainc);
}
$input = Input::only(array('datefilter', 'datefrom', 'dateto', 'timefilter', 'timefrom', 'timeto', 'durationparam', 'durationfilter', 'duration', 'fromfilter', 'from', 'tofilter', 'to'));
$rules = array('datefrom' => 'required_with:datefilter', 'timefrom' => 'required_with:timefilter', 'duration' => 'required_with:durationfilter');
$v = Validator::make($input, $rules);
if ($v->fails()) {
return Output::push(array('path' => 'call_detail_reports', 'errors' => $v, 'input' => TRUE));
}
$bulan_ayeuna = "AND YEAR(call_start_time) = YEAR(curdate()) AND MONTH(call_start_time) = MONTH(curdate()) ";
if ($input['datefilter'] || $input['timefilter'] || $input['durationfilter'] || $input['fromfilter'] || $input['tofilter']) {
$q = "select * from opensips.cdrs where ";
$q = $q . "(" . $condq . ") ";
if ($input['datefilter']) {
if ($input['datefrom'] && $input['dateto']) {
$fromdate = $this->_intlDate($input['datefrom']);
$todate = $this->_intlDate($input['dateto']);
$q = $q . "AND (date(call_start_time) BETWEEN '" . $fromdate . "' AND '" . $todate . "') ";
} elseif ($input['datefrom'] && !$input['dateto']) {
$fromdate = $this->_intlDate($input['datefrom']);
$todate = date("Y-m-d");
$q = $q . "AND (date(call_start_time) >= '" . $fromdate . "') ";
}
} else {
$q = $q . $bulan_ayeuna;
}
if ($input['timefilter']) {
if ($input['timefrom'] && $input['timeto']) {
$q = $q . "AND (time(call_start_time) BETWEEN '" . $input['timefrom'] . "' AND '" . $input['timeto'] . "') ";
} elseif ($input['timefrom'] && !$input['timeto']) {
$q = $q . "AND (time(call_start_time) >= ";
$q = $q . "'" . $input['timefrom'] . "') ";
}
}
if ($input['durationfilter']) {
$duration = $this->_getDuration($input['duration']);
$q = $q . "AND (duration " . $input['durationparam'] . " " . $duration . ") ";
}
if ($input['fromfilter']) {
$fromarr = explode("@", $input['from']);
if (!isset($fromarr[1])) {
$fromarr[1] = null;
}
if ($fromarr[1] == null) {
$q = $q . "AND (src_uri = '" . $input['from'] . "') ";
} else {
$q = $q . "AND (src_uri = '" . $fromarr[0] . "' and caller_domain = '" . $fromarr[1] . "') ";
}
}
if ($input['tofilter']) {
$toarr = explode("@", $input['to']);
if (!isset($toarr[1])) {
$toarr[1] = null;
}
if ($toarr[1] == null) {
$q = $q . "AND (dst_uri = '" . $input['to'] . "') ";
} else {
$q = $q . "AND (dst_uri = '" . $toarr[0] . "' and callee_domain = '" . $toarr[1] . "') ";
}
}
$q = $q . "order by call_start_time desc";
$results = [];
$results = DB::connection('mysql2')->select($q);
//print_r($q);
return View::make('call_detail_reports.index')->with('call_detail_reports', $results);
} else {
return View::make('call_detail_reports.index')->with('call_detail_reports', $call_detail_report);
}
}