本文整理汇总了PHP中Stream::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Stream::where方法的具体用法?PHP Stream::where怎么用?PHP Stream::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stream
的用法示例。
在下文中一共展示了Stream::where方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect
$message['message'] = "Name field is empty";
} else {
if (empty($_POST['streamurl'])) {
$message['type'] = "error";
$message['message'] = "streamurl is empty";
} else {
if (empty($_POST['category'])) {
$message['type'] = "error";
$message['message'] = "Select one category";
} else {
if (isset($_GET['id'])) {
$message['type'] = "success";
$message['message'] = "Stream saved";
$stream->save();
} else {
$exists = Stream::where('name', '=', $_POST['name'])->get();
if (count($exists) > 0) {
$message['type'] = "error";
$message['message'] = "streamname already in use";
} else {
$message['type'] = "success";
$message['message'] = "Stream created";
$stream->save();
redirect("manage_stream.php?id=" . $stream->id, 1000);
}
}
}
}
}
}
echo $template->view()->make('manage_stream')->with('stream', $stream)->with('categories', $categories)->with('transcodes', $transcodes)->with('message', $message)->with('title', $title)->render();
示例2: foreach
}
if (isset($_POST['mass_start'])) {
if (isset($_POST['mselect'])) {
foreach ($_POST['mselect'] as $streamids) {
start_stream($streamids);
}
}
$message['type'] = "success";
$message['message'] = "Streams started";
}
if (isset($_POST['mass_stop'])) {
if (isset($_POST['mselect'])) {
foreach ($_POST['mselect'] as $streamids) {
stop_stream($streamids);
}
}
$message['type'] = "success";
$message['message'] = "Streams stopped";
}
if (isset($_GET['running']) && $_GET['running'] == 1) {
$title = "Running Streams";
$stream = Stream::where('status', '=', 1)->get();
} else {
if (isset($_GET['running']) && $_GET['running'] == 2) {
$title = "Stopped Streams";
$stream = Stream::where('status', '=', 2)->get();
} else {
$stream = Stream::all();
}
}
echo $template->view()->make('streams')->with('streams', $stream)->with('message', $message)->with('title', $title)->render();
示例3: foreach
<?php
//if(isset($_SERVER['SERVER_ADDR'])) {
// if( $_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR'] ){
// die('access is not permitted');
// }
//}
include 'config.php';
$setting = Setting::first();
$streams = Stream::where('pid', '!=', 0)->where('running', '=', 1)->get();
foreach ($streams as $stream) {
if (!checkPid($stream->pid)) {
$stream->checker = 0;
$checkstreamurl = shell_exec('/usr/bin/timeout 15s ' . $setting->ffprobe_path . ' -analyzeduration 10000000 -probesize 9000000 -i "' . $stream->streamurl . '" -v quiet -print_format json -show_streams 2>&1');
$streaminfo = (array) json_decode($checkstreamurl);
if (count($streaminfo) > 0) {
$pid = shell_exec(getTranscode($stream->id));
$stream->pid = $pid;
$stream->running = 1;
$stream->status = 1;
if (isset($streaminfo->streams)) {
foreach ((array) $streaminfo->streams as $info) {
if ($info->codec_type == 'video') {
$stream->video_codec_name = $info->codec_long_name;
} else {
if ($info->codec_type == 'audio') {
$stream->audio_codec_name = $info->codec_long_name;
}
}
}
}
示例4:
$stream->pid = $pid;
$stream->running = 1;
$stream->status = 1;
} else {
$stream->running = 1;
$stream->status = 2;
$stream->pid = null;
}
}
}
}
}
$stream->save();
}
}
$streams2 = Stream::where('restream', '=', 1)->where('running', '=', 1)->get();
foreach ($streams2 as $stream) {
$stream->checker = 0;
$checkstreamurl = shell_exec('/usr/bin/timeout 15s ' . $setting->ffprobe_path . ' -analyzeduration 10000000 -probesize 9000000 -i "' . $stream->streamurl . '" -v quiet -print_format json -show_streams 2>&1');
$streaminfo = (array) json_decode($checkstreamurl);
if (count($streaminfo) > 0) {
$stream->checker = 0;
} else {
// fail 1
if ($stream->streamurl2) {
$checkstreamurl = shell_exec('/usr/bin/timeout 15s ' . $setting->ffprobe_path . ' -analyzeduration 10000000 -probesize 9000000 -i "' . $stream->streamurl2 . '" -v quiet -print_format json -show_streams 2>&1');
$streaminfo = (array) json_decode($checkstreamurl);
if (count($streaminfo) > 0) {
$stream->checker = 2;
} else {
// fail 2
示例5: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$event = ep\Event::find($id);
// Fetch all request data.
$data = Input::only('title', 'event_icon', 'lan', 'games', 'website', 'brackets', 'ticket_store', 'vod', 'start_date', 'finish_date', 'prizepool', 'location', 'about', 'tags', 'public_state', 'streams');
// Build the validation constraint set.
$rules = array('title' => array('required', 'min:3'), 'event_icon' => array('required', 'alpha_dash'), 'lan' => array('integer'), 'games' => array('required'), 'website' => array('url'), 'brackets' => array('url'), 'ticket_store' => array('url'), 'vod' => array('url'), 'start_date' => array('required', 'date', 'before:' . Input::get('finish_date')), 'finish_date' => array('required', 'date'), 'prizepool' => array('max:20'), 'location' => array('required_if:lan,true', 'max:25'), 'about' => array('max:21800'), 'public_state' => array('integer'), 'streams' => array('requiredOrArray', 'alpha_dashOrArray'));
// Create a new validator instance.
$validator = Validator::make($data, $rules);
if ($validator->passes()) {
$title = Input::get('title');
if ($event->title !== $title) {
$uniqid = str_shuffle(uniqid());
$event->slug = Str::slug($title, '-') . '-' . $uniqid;
$event->title = $title;
}
$event->event_icon = Input::get('event_icon');
$event->website = Input::get('website');
$event->brackets = Input::get('brackets');
$event->ticket_store = Input::get('ticket_store');
$event->vod = Input::get('vod');
$event->start_date = new DateTime(Input::get('start_date'));
$event->finish_date = new DateTime(Input::get('finish_date'));
$event->prizepool = Input::get('prizepool');
$event->about = Input::get('about');
$event->tags = Input::get('tags');
$event->lan = Input::get('lan') ? 1 : 0;
if (Input::get('lan') == true) {
$event->location = Input::get('location');
$event->latitude = Input::get('latitude');
$event->longitude = Input::get('longitude');
} else {
$event->location = 'Online';
$event->latitude = '';
$event->longitude = '';
}
$event->public_state = Input::get('public_state') ? 1 : 0;
$event->save();
$event_games = $event->eventGame()->get();
$games = Input::get('games');
foreach ($event_games as $event_game) {
if (!in_array($event_game->id, $games)) {
$event->eventGame($event_game)->detach();
}
}
foreach ($games as $game) {
$game_attach = Game::find($game);
if (!$event->eventGame()->where('game_id', '=', $game_attach->id)->first()) {
$event->eventGame()->attach($game_attach);
}
}
$event_streams = $event->eventStream()->get();
$stream_urls = Input::get('streams');
foreach ($event_streams as $event_stream) {
if (!in_array($event_stream->stream_url, $stream_urls)) {
$event->eventStream($event_stream)->detach();
}
}
foreach ($stream_urls as $stream_url) {
$stream_old = Stream::where('stream_url', '=', $stream_url)->first();
if ($stream_old == false && $stream_url) {
$stream = new Stream();
$stream->stream_url = $stream_url;
$stream->save();
$stream->streamEvent()->attach($event);
} else {
if (!$event->eventStream()->where('stream_id', '=', $stream_old->id)->first()) {
$stream_old->streamEvent()->attach($event);
}
}
}
return Redirect::to('/')->with('global_success', 'Event submitted successfuly!');
}
return Redirect::to('/event/edit/' . $event->id)->withInput()->withErrors($validator)->with('message', 'Validation Errors!');
}
示例6: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$show = Show::find($id);
$data = Input::only('title', 'show_icon', 'games', 'stream', 'people', 'vods', 'start_date', 'about', 'tags');
// Build the validation constraint set.
$rules = array('title' => array('required', 'min:3'), 'show_icon' => array('required', 'alpha_dash'), 'games' => array('required'), 'start_date' => array('required', 'date'), 'people' => array('required'), 'about' => array('max:21800'), 'stream' => array('alpha_dash'), 'vods' => array('max:21800'));
// Create a new validator instance.
$validator = Validator::make($data, $rules);
if ($validator->passes()) {
$title = Input::get('title');
if ($show->title !== $title) {
$uniqid = str_shuffle(uniqid());
$show->slug = Str::slug($title, '-') . '-' . $uniqid;
$show->title = $title;
}
$show->show_icon = Input::get('show_icon');
$show->air_date = new DateTime(Input::get('start_date'));
$show->people = Input::get('people');
$show->about = Input::get('about');
$show->tags = Input::get('tags');
$show->vods = Input::get('vods');
$show->save();
$show_games = $show->showGame()->get();
$games = Input::get('games');
foreach ($show_games as $show_game) {
if (!in_array($show_game->id, $games)) {
$show->showGame($show_game)->detach();
}
}
foreach ($games as $game) {
$game_attach = Game::find($game);
if (!$show->showGame()->where('game_id', '=', $game_attach->id)->first()) {
$show->showGame()->attach($game_attach);
}
}
$show_stream = $show->showStream()->first();
$stream_url = trim(Input::get('stream'));
if ($show_stream && $show_stream->stream_url !== $stream_url) {
$show->showStream($show_stream)->detach();
} elseif ($show_stream && $stream_url == false) {
$show->showStream($show_stream)->detach();
}
if ($stream_url) {
$stream_old = Stream::where('stream_url', '=', $stream_url)->first();
if ($stream_old == false && $stream_url) {
$stream = new Stream();
$stream->stream_url = $stream_url;
$stream->save();
$stream->streamShow()->attach($show);
} else {
if (!$show->showStream()->where('stream_id', '=', $stream_old->id)->first()) {
$stream_old->streamShow()->attach($show);
}
}
}
return Redirect::to('/')->with('global_success', 'Show submitted successfuly!');
}
return Redirect::to('/show/edit/' . $show->id)->withInput()->withErrors($validator)->with('message', 'Validation Errors!');
}
示例7: logincheck
/**
* Created by Tyfix 2015
*/
include 'config.php';
logincheck();
//Create settings if not exists
$settings = Setting::first();
if (is_null($settings)) {
$settings = new Setting();
$settings->webip = $_SERVER['SERVER_ADDR'];
$settings->webport = 8000;
$settings->save();
}
$all = Stream::all()->count();
$online = Stream::where('running', '=', 1)->count();
$offline = Stream::where('running', '=', 0)->count();
//space
$space_pr = 0;
$space_free = round(disk_free_space('/') / 1048576, 1);
$space_total = round(disk_total_space('/') / 1048576, 1);
$space_pr = (int) (100 * ($space_free / $space_total));
if (stristr(PHP_OS, 'win')) {
//cpu
$cpu_usage = 2;
$cpu_total = 10;
$cpu_pr = $cpu_usage / $cpu_total * 100;
//memory
$mem_usage = 20;
$mem_total = 120;
$mem_pr = (int) (100 * ($mem_usage / $mem_total));
} else {