本文整理汇总了PHP中Table::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::create方法的具体用法?PHP Table::create怎么用?PHP Table::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table::create方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUpdate
public function testUpdate()
{
$row = $this->table->create(array())->current();
$data = array("created" => new \pq\DateTime("2013-03-03 03:03:03"), "counter" => 2, "number" => 2.2, "data" => "this is a test", "list" => array(3, 2, 1), "prop" => null);
$row = $this->table->update(array("id = " => $row->id), $data)->current();
$data = array("id" => $row->id->get()) + $data;
$this->assertEquals($data, $row->getData());
}
示例2: index
/**
* show all torrent or one based on search.
*
* @param Request $request
*
* @return \Illuminate\View\View
*/
public function index(Request $request)
{
//$output = \Tmdb::getSearchApi()->searchMovies('saw',array('language' => 'fr'));
$perPage = 2;
$input = $request->input('q');
$tags = '';
if ($request->input('tags') != '') {
$tags = explode(',', $request->input('tags'));
}
if ($input && !$tags) {
$rows = Movie::title($input)->sortAndPaginate($perPage);
} elseif ($tags) {
$rows = Movie::title($input)->tags($tags)->sortAndPaginate($perPage);
} else {
$rows = Movie::sortAndPaginate($perPage);
}
if (!$tags) {
$tags = [];
}
$table = \Table::create($rows, ['test']);
$table->addColumn('title', 'Nom', function ($torrent) {
return $torrent->title;
});
$table->addColumn('created_at', 'Ajouté', function ($torrent) {
return $torrent->created_at->diffForHumans();
});
return view('torrents.index', ['table' => $table, 'input' => $input, 'tags' => implode(',', $tags)]);
}
示例3: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 20) as $index) {
Table::create(['number' => $index, 'seats' => $faker->randomElement([2, 4, 8]), 'position' => $faker->sentence(1), 'description' => $faker->text(200), 'available' => rand(0, 1), 'image_url' => $faker->imageUrl($width = 640, $height = 480)]);
}
}
示例4: search
public function search(Request $request)
{
$post = $request->all();
$query = $post['search'];
$result = exam::where('exam_name', 'LIKE', '%' . $query . '%')->paginate(5);
$table = \Table::create($result, ['id', 'exam_name', 'total_question', 'duration_per_que', 'mark_per_que', 'passing_marks', 'exam_status']);
return view('admin.manage_exam')->with('searchResult', $table);
}
示例5: search
public function search(Request $request)
{
$post = $request->all();
$que = $post['search'];
$exam_id = $post['exam_id'];
$result = question::where('question', 'LIKE', '%' . $que . '%')->where('exam_id', $exam_id)->paginate(5);
$table = \Table::create($result, ['question', 'correct_ans']);
return view('admin.manage_questions')->with('searchResult', $table)->with('exam_id', $exam_id);
}
示例6: show
public function show($config)
{
if (empty($config['view'])) {
throw new \Exception(__METHOD__ . '. View parameter not defined.');
}
if (empty($config['name'])) {
throw new \Exception(__METHOD__ . '. Javascript datatable variable name not defined.');
}
$other_info = array_key_exists('other-info', $config) ? $config['other-info'] : [];
// $this->layout->title = strip_tags($config['caption']);
if (!$config['form']) {
$form = NULL;
} else {
$form = $config['form']::make()->other_info($other_info);
}
return view($config['view'], ['dt' => Table::create($config), 'toolbar' => \View::make($config['toolbar'])->with($other_info)->render(), 'form' => $form] + $other_info);
}
示例7: array
$e->addField('openat');
$e->addField('time');
$e->addField('location');
$e->addField('short');
$e->addField('description');
$e->addField('archive');
$e->addField('hashtag');
$e->addField('facebook');
$e->addField('image');
$e->addField('imagesection');
$e->addField('gallery');
$e->addField('audio');
$e->addField('color');
$e->addField('number_staff');
$e->addField('number_visitors');
Table::create('categories', array('title'));
$c = new Table('categories');
$c->addField('deleted');
$c->addField('color');
$c->addField('hidden_in_archive');
Table::create('locations', array('title'));
$l = new Table('locations');
$l->addField('deleted');
$l->addField('website');
$l->addField('address');
$l->addField('lon');
$l->addField('lat');
// Add Options
Option::add('events_image_directory', '/');
Option::add('events_placeholder_archive', '');
Option::add('events_audio_directory', '/');
示例8: Authorizer
<?php
require_once '../func/admin.class.php';
$authorizer = new Authorizer();
$uid = $authorizer->isLogged();
require_once '../func/admin.class.php';
require_once '../inc/vars.php';
if ($_POST['_check']) {
if ($_POST['_name']) {
$table = new Table(MT_TABLE);
$table->create($_POST['_name']);
die('<p>Table created succesfully</p><p><a href="#" onclick="return c_new_table()">Close</a></p>');
} else {
echo '<span class="error">Please provide a table name</span>';
}
}
?>
<div id="form-small">
<form id="new_table" method="post" action="">
<div class="form-row">
<div class="field-label">Table Name</div>
<div class="field-widget"><input type="text" name="_name" class="required" size="20"></div>
</div>
<input type="hidden" name ="_check" value="1"/>
<input type="submit" value="Create" onclick="return new_table()"/>
</form>
</div>
示例9: Table
<?php
// Create the table
if (Table::create('slider', ['title', 'summary', 'link', 'category', 'target', 'order', 'misc_text', 'image'])) {
// created a new table
}
$table = new Table('slider');
$table->updateField('button_class', 'misc_text');
$table->deleteField('has_button');
// Ensure there is a slider snipper (don't overwrite though)
$snippets_path = STORAGE . DS . 'snippets' . DS;
$install_path = PLUGINS . DS . 'slider' . DS . 'install' . DS;
if (!File::exists($snippets_path . 'slider.snippet.php')) {
// Copy our default one
File::copy($install_path . 'slider.default.snippet.php', $snippets_path . 'slider.snippet.php');
}
示例10: renderRows
protected function renderRows(Rows $rows)
{
Table::create($rows)->render();
}
示例11: index
public function index()
{
$result = user::where('status', 1)->sorted()->paginate(5);
$table = \Table::create($result, ['name', 'email']);
return view('admin.admin_registration')->with('result', $table);
}
示例12: testCreateInvalidData
/**
* @expectedException \InvalidArgumentException
*/
public function testCreateInvalidData()
{
$table = new Table($this->connection, 'psx_handler_comment', array('foo' => TableInterface::TYPE_VARCHAR));
$table->create('foo');
}