本文整理汇总了PHP中Channel::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Channel::create方法的具体用法?PHP Channel::create怎么用?PHP Channel::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channel
的用法示例。
在下文中一共展示了Channel::create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
//
$interactor = new CurlInteractor();
$interactor->setResponseFactory(new SlackResponseFactory());
$commander = new Commander($_ENV['SLACK_KEY'], $interactor);
$response = $commander->execute('channels.list');
$responseBody = $response->getBody();
if (!$responseBody or !$responseBody['ok']) {
throw new Exception('Sth Error Happened!');
}
foreach ($responseBody['channels'] as $chan) {
if (!$chan['is_channel']) {
continue;
}
$chanData = ['sid' => $chan['id'], 'name' => $chan['name'], 'created' => $chan['created'], 'creator' => $chan['creator'], 'purpose' => (object) $chan['purpose'], 'is_archived' => $chan['is_archived'], 'is_member' => $chan['is_member'], 'num_members' => $chan['num_members'], 'members' => $chan['members'], 'topic' => (object) $chan['topic']];
if ($channel = Channel::where('sid', $chan['id'])->first()) {
foreach ($chanData as $k => $v) {
$channel->{$k} = $v;
}
$channel->save();
} else {
$chanData['latest'] = 0;
Channel::create($chanData);
}
}
}
示例2: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Channel::create([]);
}
}
示例3: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('channels', function (Blueprint $table) {
$table->integer('id');
$table->string('name');
$table->timestamps();
});
Channel::create(['id' => '1', 'name' => 'Booking.com']);
Channel::create(['id' => '2', 'name' => 'Wotif.com']);
}
示例4:
$object->format();
require_once AmpConfig::get('prefix') . UI::find_template('show_add_channel.inc.php');
}
}
UI::show_footer();
exit;
case 'create':
if (AmpConfig::get('demo_mode')) {
UI::access_denied();
exit;
}
if (!Core::form_verify('add_channel', 'post')) {
UI::access_denied();
exit;
}
$created = Channel::create($_REQUEST['name'], $_REQUEST['description'], $_REQUEST['url'], $_REQUEST['type'], $_REQUEST['id'], $_REQUEST['interface'], $_REQUEST['port'], $_REQUEST['admin_password'], $_REQUEST['private'] ?: 0, $_REQUEST['max_listeners'], $_REQUEST['random'] ?: 0, $_REQUEST['loop'] ?: 0, $_REQUEST['stream_type'], $_REQUEST['bitrate']);
if (!$created) {
require_once AmpConfig::get('prefix') . UI::find_template('show_add_channel.inc.php');
} else {
$title = T_('Channel Created');
show_confirmation($title, $body, AmpConfig::get('web_path') . '/browse.php?action=channel');
}
UI::show_footer();
exit;
case 'show_delete':
$id = $_REQUEST['id'];
$next_url = AmpConfig::get('web_path') . '/channel.php?action=delete&id=' . scrub_out($id);
show_confirmation(T_('Channel Delete'), T_('Confirm Deletion Request'), $next_url, 1, 'delete_channel');
UI::show_footer();
exit;
case 'delete':