本文整理汇总了PHP中resource函数的典型用法代码示例。如果您正苦于以下问题:PHP resource函数的具体用法?PHP resource怎么用?PHP resource使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resource函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: class_init
public static function class_init()
{
/** @var Settings $settings */
$settings = resource(Settings::class);
self::$redis = new \Redis();
self::$redis->connect($settings->get("redis", "hostname"), $settings->get("redis", "connect_port"));
}
示例2: __construct
/**
* @param $track_id
* @throws BadAccessException
*/
public function __construct($track_id)
{
$this->settings = resource(Settings::class);
$this->me = resource(LoggedIn::class);
if (is_array($track_id)) {
$this->track_data = $track_id;
} else {
$this->track_data = SongDao::getSongUsingId($track_id);
}
$this->track_id = $this->track_data[TSongs::ID];
$this->checkPermission();
}
示例3: make_resource
function make_resource($name, $controller, $options = [])
{
resource($name, $controller, $options);
$uri = '/' . str_replace('.', '/{id}/', $name);
if (in_array('update', array_get($options, 'only'))) {
post($uri . '/{idz}', ['uses' => $controller . '@update', 'as' => env('API') . '.' . $name . '.update-post']);
}
if (in_array('update', array_get($options, 'only'))) {
post($uri . '/{idz}/update', ['uses' => $controller . '@update', 'as' => env('API') . '.' . $name . '.update2-post']);
}
if (in_array('destroy', array_get($options, 'only'))) {
post($uri . '/{idz}/destroy', ['uses' => $controller . '@destroy', 'as' => env('API') . '.' . $name . '.destroy-post']);
}
}
示例4: WymInput
public function WymInput($label, $forField, $options = array())
{
$this->view->addHeadItem('WymCSS', $this->view->style(resource('wymeditor/skins/default/screen.css'), true));
$this->view->addHeadItem('WymJS', $this->view->script(resource('wymeditor/jquery.wymeditor.js'), true));
?>
<p>
<label for="<?php
echo $forField;
?>
"><?php
echo $label;
?>
</label>
<textarea class="wymeditor" id="<?php
echo $forField;
?>
" name="<?php
echo $forField;
?>
"><?php
echo $this->view->model->{$forField} != null ? $this->view->o($this->view->model->{$forField}, false) : $this->view->o('<p> </p>', false);
?>
</textarea>
</p>
<script type="text/javascript">
$(document).ready(function() {
$('#<?php
echo $forField;
?>
').wymeditor({
<?php
foreach ($options as $k => $v) {
echo $k . ':' . $v . ',';
}
?>
jQueryPath: '<?php
echo resource('jquery-1.2.2-b.js');
?>
'
});
});
</script>
<?php
}
示例5: get
<?php
get('/', function () {
return view('layouts.index');
});
resource('/dashboard', 'DashboardController');
resource('products', 'ProductController');
resource('product-types', 'ProductTypeController');
get('/product-photos', function () {
return \App\ProductPhoto::all();
});
post('products/file-upload/{id}', 'ProductController@fileUpload');
示例6: function
<?php
Route::group(['prefix' => 'api/v1'], function () {
resource('projects.daily-records', DailyRecordsController::class);
});
示例7: resource
<?php
resource('posts', 'PostController');
//method index
resource('comments', 'CommentController', ['except' => ['index', 'create', 'show']]);
resource('users', 'UserController', ['except' => ['create', 'store']]);
post('posts/{posts}/comments', 'CommentController@store');
//resource('roles', 'RoleController', ['only' => ['show']]);
get('roles/{roles}', 'RoleController@show');
get('tags/{tags}', 'TagController@show');
$router->controllers(['likes' => 'LikeController', 'home' => 'HomeController', 'auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController', '/' => 'WelcomeController']);
//Route::get() or $router->get() or get()
//Route::resource('home', 'HomeController');//method index
// Route::controllers([
// 'home' => 'HomeController',//method getIndex
// 'auth' => 'Auth\AuthController',
// 'password' => 'Auth\PasswordController',
// 'test' => 'TraianController',
// '/' => 'WelcomeController',
// ]);
//Route::controller('/', 'WelcomeController');
示例8: resource
<?php
require_once 'config.php';
/* ----------------------- ПАРАМЕТРЫ СТРАНИЦЫ ----------------------- */
$page['title'] = 'Лог';
$page['desc'] = 'Лог сервера';
resource(['datatables/datatables/media/css/jquery.dataTables.min.css', 'datatables/datatables/media/js/jquery.dataTables.min.js', <<<JS
\$(document).ready(function() {
\$('table').DataTable( {
"language": {
"url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Russian.json"
}
} );
} );
JS
]);
/* ---------------------- КОНТРОЛЛЕР СТРАНИЦЫ ----------------------- */
// Запрашиваем записи лога, относящиеся к API
$logs = db_array("SELECT *, " . "DATE_FORMAT(`created_at`, '%d.%m.%y в %H:%m:%s') AS `time` " . "FROM `log`" . "WHERE `type` = 'API'" . "ORDER BY `created_at` DESC");
/* -------------------------- ОТОБРАЖЕНИЕ ------------ */
ob_start();
?>
<h2>Лог запросов к серверу</h2>
<hr />
<table class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>Время</th>
<th>Значение</th>
示例9: function
<?php
Route::group(['prefix' => 'api/v1'], function () {
get('daily-appliances', DailyAppliancesController::class . '@all');
get('projects/{projects}/daily-appliances/total-amount', DailyAppliancesController::class . '@getTotalAmount');
resource('projects.daily-appliances', DailyAppliancesController::class);
});
示例10: resource
<?php
require_once 'config.php';
/* ----------------------- ПАРАМЕТРЫ СТРАНИЦЫ ----------------------- */
$page['title'] = 'Список клиентов';
$page['desc'] = 'Редактирование данных в табличной форме (CRUD)';
resource(['datatables/datatables/media/css/jquery.dataTables.min.css', 'datatables/datatables/media/js/jquery.dataTables.min.js']);
// Настройки CRUD редактора на этой странице
$page['crud_editor'] = ['messages' => ['elements_list' => 'Список клиентов', 'delete_success' => 'Клиент успешно удален', 'delete_error' => 'Ошибка при удалении клиента', 'create_success' => 'Клиент успешно создан', 'save_success' => 'Информация о клиенте успешно отредактирована', 'create_error' => 'Ошибка при создании клиента', 'save_error' => 'Ошибка при сохранении данных клиента', 'edit_element' => 'Редактирование клиента', 'create_element' => 'Добавление нового клиента', 'new_element' => 'Добавить клиента'], 'table' => 'users', 'primary_key' => 'id', 'fields' => ['name' => ['desc' => 'Имя', 'type' => 'text', 'dadata' => ['type' => 'NAME'], 'required' => true], 'address' => ['desc' => 'Адрес', 'type' => 'text', 'dadata' => ['type' => 'ADDRESS', 'yandex_map' => true]], 'company' => ['desc' => 'Организация', 'type' => 'text', 'dadata' => ['type' => 'PARTY']], 'bank' => ['desc' => 'Банк', 'type' => 'text', 'dadata' => ['type' => 'BANK']], 'email' => ['desc' => 'Адрес электронной почты', 'type' => 'text', 'dadata' => ['type' => 'EMAIL']], 'create_at' => ['desc' => 'Дата регистрации', 'type' => 'timestamp', 'access_edit' => []]], 'table_list_fields' => ['id' => ['desc' => '#id'], 'name' => ['desc' => 'Имя'], 'address' => ['desc' => 'Адрес'], 'company' => ['desc' => 'Организация'], 'bank' => ['desc' => 'Банк'], 'email' => ['desc' => 'Электронная почта']], 'list_request' => "SELECT * FROM `users`", 'hide_edit' => false, 'sort_column' => 1, 'sort_order' => 'asc', 'display_length' => 5];
/* ---------------------- КОНТРОЛЛЕР СТРАНИЦЫ ----------------------- */
require MC_ROOT . '/scripts/crud_editor/core.php';
/* -------------------------- ОТОБРАЖЕНИЕ ------------ */
ob_start();
?>
<h2><?php
echo $page['title'];
?>
</h2>
<hr />
<div class="row">
<div class="col-xs-12 mtop-20">
<?php
require MC_ROOT . "/templates/{$page['view']}.php";
?>
</div><!-- /.col -->
</div><!-- /.row -->
<?php
require MC_ROOT . '/scripts/render_view.php';
示例11: function
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::group(['namespace' => 'Operator', 'prefix' => 'operator', 'middleware' => ['auth', 'operator']], function () {
get('dashboard', ['as' => 'operator.dashboard', 'uses' => 'DashboardController@index']);
resource('notif', 'NotifController');
resource('paket', 'PaketController');
resource('member', 'MemberController');
resource('galery', 'GaleryController');
});
Route::group(['prefix' => 'member', 'middleware' => ['auth']], function () {
Route::resource('reservation', 'ReservationController');
Route::get('/dashboard', ['as' => 'member.dashboard', 'uses' => 'ReservationController@dashboard']);
Route::get('/wait/{id}', ['as' => 'wait', 'uses' => 'ReservationController@wait']);
});
Route::get('/', ['as' => 'welcome', 'uses' => 'WelcomeController@index']);
Route::get('/paket_detail/{id}', ['as' => 'paket.detail', 'uses' => 'WelcomeController@show']);
Route::post('/paket_detail/{id}', ['as' => 'paket.detail', 'uses' => 'WelcomeController@show']);
Route::get('/print/tiket/{id}', ['middleware' => 'auth'], function ($id) {
$reservation = Reservation::with('user', 'paket')->find($id);
return view('partials.print', compact('reservation'));
});
Route::controller('auth', 'Auth\\AuthController', ['getLogin' => 'auth.login', 'postLogin' => 'post.login', 'getLogout' => 'auth.logout', 'getRegister' => 'auth.register', 'postRegister' => 'post.register']);
Route::controller('password', 'Auth\\PasswordController');
示例12: array
if ($this->u()->hasRole(User::ROLE_USER)) {
?>
<?php
$this->addToPane(build_url('task', 'edit', array('projectid' => $childProject->id)), '<img src="' . resource('images/add.png') . '" />', 'Create new task in ' . $childProject->title, 'RightPane');
?>
<?php
$this->addToPane(build_url('project', 'edit', array('id' => $childProject->id)), '<img src="' . resource('images/pencil.png') . '" />', 'Edit ' . $childProject->title, 'RightPane');
?>
<?php
}
?>
<!--<a href="<?php
echo build_url('project', 'view', array('id' => $childProject->id));
?>
"><img src="<?php
echo resource('images/eye.png');
?>
" /></a> -->
</h3>
<p>
<?php
$this->bbCode($childProject->description);
?>
</p>
<div>
<ul class="largeList">
<li><?php
$this->addToPane(build_url('feature', 'milestonelist', array('milestoneid' => $childProject->id)), "Features", 'Features of ' . $childProject->title);
?>
</li>
<li><a href="#" onclick="$('#project-task-summary-<?php
示例13: build_url
?>
-projects"></div>
</div>
<div class="info-block">
<!--<input style="float: right;" type="button" onclick="location.href='<?php
echo build_url('client', 'edit', array('id' => $client->id));
?>
';" value="Edit" />-->
<h3>
<a style="float: right;" href="<?php
echo build_url('client', 'edit', array('id' => $client->id));
?>
"><img src="<?php
echo resource('images/pencil.png');
?>
" /></a>
<?php
$this->addNote($client->name, $client->id, 'client');
?>
<?php
$this->viewNotes($client->id, 'client');
?>
Details
</h3>
<div class="micro-column gainlayout">
<p>
<strong>Name</strong><br/>
<?php
示例14: resource
<?php
if ($expense->status == Expense::DENIED) {
?>
<img title="denied" src="<?php
echo resource('images/cross.png');
?>
" />
<?php
}
?>
<?php
if (!empty($expense->paiddate)) {
?>
<img src="<?php
echo resource('images/coins.png');
?>
" title="Paid <?php
$this->o($this->u()->formatDate($expense->paiddate));
?>
" />
<?php
}
?>
</td>
</tr>
<?php
}
?>
</tbody>
示例15: function
<?php
Route::group(['prefix' => 'api/v1'], function () {
get('subcontractors', SubcontractorsController::class . '@index');
});
Route::group(['middleware' => ['csrftoken']], function () {
resource('subcontractors', SubcontractorsController::class);
});