本文整理汇总了PHP中app\models\Client::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::all方法的具体用法?PHP Client::all怎么用?PHP Client::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Client
的用法示例。
在下文中一共展示了Client::all方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Request $request)
{
/* This checks the client list for the CID. If a matching CID is found, all caching will be ignored
for this request */
if (Cache::has('clients')) {
$clients = Cache::get('clients');
} else {
$clients = Client::all();
Cache::put('clients', $clients, 1);
}
if (Cache::has('keys')) {
$keys = Cache::get('keys');
} else {
$keys = Key::all();
Cache::put('keys', $keys, 1);
}
$input_cid = $request->input('cid');
if (!empty($input_cid)) {
foreach ($clients as $client) {
if ($client->uuid == $input_cid) {
$this->client = $client;
}
}
}
$input_key = $request->input('k');
if (!empty($input_key)) {
foreach ($keys as $key) {
if ($key->api_key == $input_key) {
$this->key = $key;
}
}
}
}
示例2: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
if (\Auth::guest()) {
return redirect('auth/login');
}
$clients = Client::all();
return view('clients/index')->with('clients', $clients);
}
示例3: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$table_file = 'File';
// capital in mysql !
$table_job = 'Job';
// capital in mysql !
$timediff = null;
$hoursdiff = null;
$hoursbytes = null;
/* Get Database Size */
if (\Config::get('database.default') == 'mysql') {
$dbsize = \DB::select('SELECT table_schema "Data Base Name",
SUM( data_length + index_length) / 1024 / 1024 "dbsize"
FROM information_schema.TABLES
WHERE table_schema = "' . \Config::get('database.connections.mysql.database') . '"
GROUP BY table_schema ;');
} else {
$dbsize = \DB::select("SELECT pg_database_size('" . \Config::get('database.connections.pgsql.database') . "') as dbsize");
}
// Get Server Hostname
$servername = gethostname();
// Get Number of Clients
$clientsNumber = Client::all()->count();
// Get Number of Files Transfered
$filesNumber = \DB::table($table_file)->select(\DB::raw('count(*) AS filesNumber'))->get();
// Get Storage Bytes
$bytesStorage = Media::sum('volbytes');
//* Query For Hour Starts
$dataInicio = date('Y-m-d', strtotime("-1 days")) . ' 18:29';
$dataFim = date('Y-m-d') . ' 18:29';
if (\Config::get('database.default') == 'mysql') {
/* Query timediff Stats */
$timediff = \DB::table($table_job)->select(\DB::raw('TIMEDIFF(max(starttime) , min(starttime)) AS timediff'))->where('starttime', '>=', $dataInicio)->where('endtime', '<=', $dataFim)->get();
$hoursdiff = \DB::table($table_job)->select(\DB::raw("(HOUR(TIMEDIFF(max(starttime), min(starttime))) + (MINUTE(TIMEDIFF(max(starttime) , min(starttime))) / 60.0)) AS hoursdiff"))->where('starttime', '>=', $dataInicio)->where('endtime', '<=', $dataFim)->get();
$hoursbytes = \DB::table($table_job)->select(\DB::raw("(sum(jobbytes)/(HOUR(TIMEDIFF(max(starttime) , min(starttime))) + (MINUTE(TIMEDIFF(max(starttime) , min(starttime))) / 60.0))) AS hoursbytes"))->where('starttime', '>=', $dataInicio)->where('endtime', '<=', $dataFim)->get();
$query = \DB::table($table_job)->where('starttime', '>=', $dataInicio)->where('endtime', '<=', $dataFim);
$fnumber = $filesNumber[0]->filesNumber;
} elseif (\Config::get('database.default') == 'pgsql') {
/* Query timediff Stats */
$timediff = \DB::table($table_job)->select(\DB::raw('(max(starttime) - min(starttime)) AS timediff'))->where('starttime', '>=', $dataInicio)->where('endtime', '<=', $dataFim)->get();
$hoursdiff = \DB::table($table_job)->select(\DB::raw("(date_part('hour', (max(starttime) - min(starttime))) + (date_part('minutes', (max(starttime) - min(starttime))) / 60.0)) AS hoursdiff"))->where('starttime', '>=', $dataInicio)->where('endtime', '<=', $dataFim)->get();
$hoursbytes = \DB::table($table_job)->select(\DB::raw("(sum(jobbytes)/(date_part('hour', (max(starttime) - min(starttime))) + (date_part('minutes', (max(starttime) - min(starttime))) / 60.0))) AS hoursbytes"))->where('starttime', '>=', $dataInicio)->where('endtime', '<=', $dataFim)->get();
$query = \DB::table($table_job)->where('starttime', '>=', $dataInicio)->where('endtime', '<=', $dataFim);
$fnumber = $filesNumber[0]->filesnumber;
}
$jobbytes = $query->sum('jobbytes');
$starttime = $query->min('starttime');
$endtime = $query->max('endtime');
/* Data for Stats to Insert*/
$daystats = array('data' => date('Y-m-d'), 'server' => $servername, 'bytes' => $bytesStorage, 'files' => $fnumber, 'clients' => $clientsNumber, 'databasesize' => $dbsize[0]->dbsize);
$hourstats = array('data' => date('Y-m-d'), 'server' => $servername, 'bytes' => $jobbytes, 'starttime' => $starttime, 'endtime' => $endtime, 'timediff' => $timediff[0]->timediff, 'hoursdiff' => (int) $hoursdiff[0]->hoursdiff, 'hourbytes' => $hoursbytes[0]->hoursbytes);
Hoursstats::firstOrCreate($hourstats);
Daystats::firstOrCreate($daystats);
}
示例4: typeahead
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function typeahead()
{
$clients = Client::all();
$all = [];
foreach ($clients as $client) {
$row = new \stdClass();
$row->id = $client->id;
$row->name = $client->name;
$all[] = $row;
}
$this->data->data = $all;
return $this->json();
}
示例5: clientSelectBox
public static function clientSelectBox($clientsall = null)
{
if ($clientsall == null) {
$clientsall = Client::all()->toArray();
}
// Code to resolve pgsql names
$f_Name = 'Name';
$f_ClientID = 'ClientId';
if (Config::get('database.default') == 'pgsql') {
$f_Name = strtolower($f_Name);
$f_ClientID = strtolower($f_ClientID);
}
//Both Engines :
$clientsName = array_fetch($clientsall, $f_Name);
$clientsId = array_fetch($clientsall, $f_ClientID);
$clientSelectBox = array_combine($clientsId, $clientsName);
natsort($clientSelectBox);
return $clientSelectBox;
}
示例6: insertStats
public function insertStats()
{
/* Get Database Size */
if (Config::get('database.default') == "mysql") {
$dbsize = DB::select('SELECT table_schema "Data Base Name",
SUM( data_length + index_length) / 1024 / 1024 "dbsize"
FROM information_schema.TABLES
WHERE table_schema = "' . Config::get('database.connections.mysql.database') . '"
GROUP BY table_schema ;');
} else {
$dbsize = DB::select("SELECT pg_database_size('" . Config::get('database.connections.pgsql.database') . "') as dbsize");
}
// Get Server Hostname
$servername = gethostname();
// Get Number of Clients
$clientsNumber = Client::all()->count();
// Get Number of Files Transfered
$filesNumber = DB::table('file')->select(DB::raw('count(*) AS filesNumber'))->get();
// Get Storage Bytes
$bytesStorage = Media::sum('volbytes');
//* Query For Hour Starts
$dataInicio = date('Y-m-d', strtotime("-1 days")) . ' 18:29';
$dataFim = date('Y-m-d') . ' 18:29';
/* Query timediff Stats */
$timediff = DB::table('job')->select(DB::raw('(max(starttime) - min(starttime)) AS timediff'))->where('starttime', '>=', $dataInicio)->where('endtime', '<=', $dataFim)->get();
$hoursdiff = DB::table('job')->select(DB::raw("date_part('hour', (max(starttime) - min(starttime))) AS hoursdiff"))->where('starttime', '>=', $dataInicio)->where('endtime', '<=', $dataFim)->get();
$hoursbytes = DB::table('job')->select(DB::raw("(sum(jobbytes)/date_part('hour', (max(starttime) - min(starttime)))) AS hoursbytes"))->where('starttime', '>=', $dataInicio)->where('endtime', '<=', $dataFim)->get();
$query = DB::table('job')->where('starttime', '>=', $dataInicio)->where('endtime', '<=', $dataFim);
$jobbytes = $query->sum('jobbytes');
$starttime = $query->min('starttime');
$endtime = $query->max('endtime');
/* Data for Stats to Insert*/
$daystats = array('data' => date('Y-m-d'), 'server' => $servername, 'bytes' => $bytesStorage, 'files' => $filesNumber[0]->filesnumber, 'clients' => $clientsNumber, 'databasesize' => $dbsize[0]->dbsize);
$hourstats = array('data' => date('Y-m-d'), 'server' => $servername, 'bytes' => $jobbytes, 'starttime' => $starttime, 'endtime' => $endtime, 'timediff' => $timediff[0]->timediff, 'hoursdiff' => $hoursdiff[0]->hoursdiff, 'hourbytes' => $hoursbytes[0]->hoursbytes);
$hourstats = Hoursstats::firstOrCreate($hourstats);
$daystats = Daystats::firstOrCreate($daystats);
$t = Hoursstats::insert($hourstats);
$d = Daystats::insert($daystats);
}
示例7: getIndex
/**
* show the invite request to the user
*
* @return Response
*/
public function getIndex()
{
$this->data->clients = Client::all();
return $this->view('home.index');
}
示例8: function
// I know this is bad. It's gonna be gone soon.
Route::get('projtypedelete/{id}', ['as' => 'projtypedelete', 'uses' => 'ProjectTypesController@destroy']);
Route::get('projdelete/{id}', ['as' => 'projdelete', 'uses' => 'ProjectsController@destroy']);
Route::get('quotedelete/{id}', ['as' => 'quotedelete', 'uses' => 'QuotesController@destroy']);
Route::get('clientdelete/{id}', ['as' => 'clientdelete', 'uses' => 'ClientsController@destroy']);
Route::get('messagedelete/{id}', ['as' => 'messagedelete', 'uses' => 'MessagesController@destroy']);
Route::get('filedelete/{id}', ['as' => 'filedelete', 'uses' => 'FilesController@destroy']);
Route::get('filetypedelete/{id}', ['as' => 'filetypedelete', 'uses' => 'FileTypesController@destroy']);
Route::get('coverdelete/{id}', ['as' => 'coverdelete', 'uses' => 'CoverLettersController@destroy']);
Route::post('generateLegitSlug', ['as' => 'generateLegitSlug', 'uses' => 'Blog\\BlogPostsController@generateLegitSlug']);
Route::get('getfilesbytype/{id?}', ['as' => 'getfilesbytype', 'uses' => 'FilesController@getFilesByTypeId']);
Route::get('/', function () {
return view('admin.index');
});
Route::get('/clients', function () {
$clients = \App\Models\Client::all();
$quotes = \App\Models\Quote::all();
return view('admin.clients', ['clients' => $clients, 'quotes' => $quotes]);
});
});
Route::get('/speech', function () {
return view('speechdemo');
});
Route::get('/blog', function () {
$posts = \App\Models\Blog_Post::with('Author')->with('picture')->get();
return view('front.blog.index', ['posts' => $posts]);
});
Route::get('/blog/{slug}', function ($slug) {
$post = \App\Models\Blog_Post::where('slug', $slug)->with('Author')->with('picture')->first();
if ($post) {
return view('front.blog.viewPost', ['post' => $post]);
示例9: getAllClients
public function getAllClients()
{
$clients = Client::all();
return self::parseToJson(["message" => "success", "clients" => $clients]);
}
示例10: getAllClientsCount
public function getAllClientsCount()
{
return Client::all()->count();
}
示例11: postMultiple
public function postMultiple()
{
/*
|
| Getting information from user
|
*/
$userInfo = array();
foreach (\Input::all() as $key => $value) {
$userInfo[$key] = $value;
}
//var_dump($userInfo);
$message = $userInfo['holidayText'];
$state = $userInfo['state'];
$spamOrClient = $userInfo['spamOrClient'];
//echo $message;
//echo $state;
//echo $spamClient;
/*
|
| Connecting to the turbosms api via soap connection
|
*/
$client = new SoapClient('http://turbosms.in.ua/api/wsdl.html');
$auth = array('login' => 'bandson', 'password' => '031194vela');
$result = $client->Auth($auth);
//echo $result->AuthResult . ' ';
/*
|
| Setting appropriate data
|
*/
$ruleMaleClient = ['state' => 'male', 'spamOrClient' => 'client'];
$ruleMaleSpam = ['state' => 'male', 'spamOrClient' => 'spam'];
$ruleMaleAll = ['state' => 'male'];
$ruleFemaleClient = ['state' => 'female', 'spamOrClient' => 'client'];
$ruleFemaleSpam = ['state' => 'female', 'spamOrClient' => 'spam'];
$ruleFemaleAll = ['state' => 'female'];
$ruleAllClient = ['spamOrClient' => 'client'];
$ruleAllSpam = ['spamOrClient' => 'spam'];
if ($state == "male") {
$str = '';
if ($spamOrClient == "spam") {
$client = Client::where($ruleMaleSpam)->get();
//echo $client;
} else {
if ($spamOrClient == "client") {
$client = Client::where($ruleMaleClient)->get();
//echo $client;
} else {
if ($spamOrClient == "spCl") {
$client = Client::where($ruleMaleAll)->get();
//echo $client;
}
}
}
foreach ($client as $row) {
$str = $str . ',' . $row->mobNum;
}
$telephones = substr($str, 1);
//echo $telephones;
} else {
if ($state == "female") {
$str = '';
if ($spamOrClient == "spam") {
$client = Client::where($ruleFemaleSpam)->get();
//echo $client;
} else {
if ($spamOrClient == "client") {
$client = Client::where($ruleFemaleClient)->get();
//echo $client;
} else {
if ($spamOrClient == "spCl") {
$client = Client::where($ruleFemaleAll)->get();
//echo $client;
}
}
}
foreach ($client as $row) {
$str = $str . ',' . $row->mobNum;
}
$telephones = substr($str, 1);
//echo $telephones;
} else {
if ($state == "all") {
$str = '';
if ($spamOrClient == "spam") {
$client = Client::where($ruleAllSpam)->get();
//echo $client;
} else {
if ($spamOrClient == "client") {
$client = Client::where($ruleAllClient)->get();
//echo $client;
} else {
if ($spamOrClient == "spCl") {
$client = Client::all();
//echo $client;
}
}
}
//.........这里部分代码省略.........