本文整理汇总了PHP中app\helpers\Helper类的典型用法代码示例。如果您正苦于以下问题:PHP Helper类的具体用法?PHP Helper怎么用?PHP Helper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Helper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadPage
public function loadPage(Request $request)
{
$this->getChart($request);
$result = new Helper();
//$result->buildNavMenuNew();
return View('linechart')->with('result', $result->buildNavMenu());
}
示例2: loadPage
public function loadPage(Request $request)
{
$nav = new Helper();
$runsModel = new \App\Run();
//$runs = $this->getRuns();
$runs = $runsModel->getRunsWithinXDays(90);
$runs_for_dropdown = $runsModel->getRunsForDropdown();
return view('Admin.edit')->with(['runs' => $runs, 'nav' => $nav->buildNavMenu(), 'runs_for_dropdown' => $runs_for_dropdown]);
}
示例3: loadPage
public function loadPage($id = null)
{
$runModel = new \App\Run();
$run = $runModel->getRun($id);
if (is_null($run)) {
\Session::flash('flash_message', 'Run not found.');
return redirect('/');
}
$nav = new Helper();
return view('runs.single')->with(['nav' => $nav->buildNavMenu(), 'run' => $run]);
}
示例4: getCharts
public function getCharts($testResultTotals)
{
$chart = new Helper();
$smoke = \Lava::DataTable();
$integration = \Lava::DataTable();
$regression = \Lava::DataTable();
$smoke->addStringColumn('TestResults')->addNumberColumn('Percent')->addRow(array('Passed', $testResultTotals['Passed']))->addRow(array('Failed', $testResultTotals['Failed']))->addRow(array('Skipped', $testResultTotals['Skipped']));
$integration->addStringColumn('TestResults')->addNumberColumn('Percent')->addRow(array('Passed', 90))->addRow(array('Failed', 5))->addRow(array('Skipped', 5));
$regression->addStringColumn('TestTesults')->addNumberColumn('Percent')->addRow(array('Passed', 82))->addRow(array('Failed', 18))->addRow(array('Skipped', 20));
$chart->getChart('SmokeTestChart', 'PieChart', 250, 250, array('078B3E', 'CD1E35', 'FCDC27'), $smoke);
$chart->getChart('IntegrationTestChart', 'PieChart', 250, 250, array('078B3E', 'CD1E35', 'FCDC27'), $integration);
$chart->getChart('RegressionTestChart', 'PieChart', 250, 250, array('078B3E', 'CD1E35', 'FCDC27'), $regression);
}
示例5: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $thread_id
* @param int $parent_id
* @return \Illuminate\Http\Response
*/
public function store(Request $request, $thread_id, $parent_id = null)
{
$user_id = Auth::user()->id;
$position = '';
$depth = 0;
$thread = DB::table('threads')->where('id', $thread_id)->first();
if ($thread == null) {
abort(404);
}
if ($parent_id != null) {
$parent = DB::table('replies')->where('id', $parent_id)->first();
if ($parent == null || $parent->thread_id != $thread_id) {
abort(404);
}
$position = $parent->position;
$depth = $parent->depth + 1;
}
// Validation
$this->validate($request, ['content' => 'string|required']);
$content = $request->input('content');
$id = DB::table('replies')->insertGetId(['thread_id' => $thread_id, 'user_id' => $user_id, 'parent_id' => $parent_id, 'content' => $content, 'depth' => $depth]);
$position = $position . Helper::appendZero($id, 5) . ',';
DB::table('replies')->where('id', $id)->update(['position' => $position]);
DB::table('threads')->where('id', $thread_id)->increment('comment_count');
DB::table('users')->where('id', $user_id)->increment('comment_count');
$author_id = DB::table('threads')->where('id', $thread_id)->first()->author_id;
DB::table('notifications')->insert(['type' => 1, 'user_id' => $author_id, 'content_id' => $thread_id]);
return redirect('/thread/' . $thread_id);
}
示例6: store
/**
* Admin login request
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$validator = Validator::make($request->all(), ['username' => 'required', 'password' => 'required']);
if ($validator->fails()) {
Flashy::error($validator->errors()->first());
return back();
}
// If we have already set an admin user, do they match?
if (Setting::has('admin_user')) {
if ($request->username != Setting::get('admin_user')['username'] && $request->username != Setting::get('admin_user')['email']) {
Flashy::error('Admin user is not recognised');
return back();
}
}
// Is this a valid plex user?
$admin_user = (array) Helper::getPlexUser($request->username, $request->password);
if (!$admin_user) {
back();
}
// So, have we got an admin user already? If not, let's set that now.
if (!Setting::has('admin_user')) {
Flashy::success('Admin user has been set to ' . $request->username);
}
Setting::set('admin_user', $admin_user);
Session::set('admin_user', $admin_user);
return back();
}
示例7: loginAction
public function loginAction()
{
$fc = FrontController::getInstance();
$model = new FrontModel();
$userModel = new UserTableModel();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$userModel->setTable('user');
$userModel->setData();
$userModel->login();
$redirect = Helper::getRedirect();
if (is_array($redirect) && !empty($redirect['url'])) {
$redirect = implode('#', $redirect);
header('Location: ' . $redirect);
exit;
}
if ($fc->getAction() !== 'loginAction') {
header('Location: ' . $_SERVER['REQUEST_URI']);
} else {
header('Location: ' . '/');
}
exit;
} else {
if ($_SESSION['user_id']) {
header('Location: /');
}
$output = $model->render('../views/user/login.php', 'withoutSliderAndSidebar');
$fc->setPage($output);
}
}
示例8: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
// image
Blade::directive('image', function ($expression) {
$externalUrl = "/img/";
$expression = substr($expression, 2, strlen($expression) - 4);
return "<?php echo '{$externalUrl}{$expression}'; ?>";
});
// breadcrumbs
Blade::directive('breadcrumbs', function ($expression) {
// return "echo with{$expression}->format('m/d/Y H:i');
$expression = \App\Helpers\Helper::substring($expression, 1, 1);
$expression = \App\Helpers\Helper::stringRemove($expression, "'");
$params = explode(", ", $expression);
$string = "";
$arrow = '<i class="fa fa-chevron-right navigation-arrow"></i>';
for ($i = 0; $i < count($params) - 1; $i += 2) {
$url = route($params[$i]);
$title = $params[$i + 1];
$string .= "<a href='{$url}'>{$title}</a>";
if (isset($params[$i + 2])) {
$string .= $arrow;
}
}
$string .= $params[count($params) - 1];
// return "< ? php echo with{$string}; ;
return $string;
});
}
示例9: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
for ($count = 1; $count <= 10; $count++) {
$thread_id = rand(1, DB::table('threads')->count());
$position = Helper::appendZero($count, 5);
$user_id = rand(1, DB::table('users')->count());
DB::table('replies')->insert(['thread_id' => $thread_id, 'user_id' => $user_id, 'content' => str_random(100), 'position' => $position . ',', 'depth' => 0]);
DB::table('threads')->where('id', $thread_id)->increment('comment_count');
DB::table('users')->where('id', $user_id)->increment('comment_count');
$author_id = DB::table('threads')->where('id', $thread_id)->first()->author_id;
DB::table('notifications')->insert(['type' => 1, 'user_id' => $author_id, 'content_id' => $count]);
}
for ($count = 11; $count <= 30; $count++) {
$parent_id = rand(1, DB::table('replies')->count());
$parent = DB::table('replies')->where('id', $parent_id)->first();
$position = $parent->position . Helper::appendZero($count, 5) . ',';
$thread_id = $parent->thread_id;
$user_id = rand(1, DB::table('users')->count());
DB::table('replies')->insert(['thread_id' => $thread_id, 'user_id' => $user_id, 'content' => str_random(100), 'parent_id' => $parent_id, 'depth' => $parent->depth + 1, 'position' => $position]);
DB::table('threads')->where('id', $thread_id)->increment('comment_count');
DB::table('users')->where('id', $user_id)->increment('comment_count');
$author_id = DB::table('threads')->where('id', $thread_id)->first()->author_id;
DB::table('notifications')->insert(['type' => 1, 'user_id' => $author_id, 'content_id' => $thread_id]);
}
}
示例10: getIndex
/**
* Returns a view with the user's profile form for editing
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v1.0]
* @return View
*/
public function getIndex()
{
// Get the user information
$user = Auth::user();
$location_list = Helper::locationsList();
return View::make('account/profile', compact('user'))->with('location_list', $location_list);
}
示例11: getCreate
/**
* Statuslabel create.
*
* @return View
*/
public function getCreate()
{
// Show the page
$statuslabel = new Statuslabel();
$use_statuslabel_type = $statuslabel->getStatuslabelType();
$statuslabel_types = Helper::statusTypeList();
return View::make('statuslabels/edit', compact('statuslabel_types', 'statuslabel'))->with('use_statuslabel_type', $use_statuslabel_type);
}
示例12: indexAction
function indexAction()
{
$fc = FrontController::getInstance();
$model = new FrontModel();
$popProducts = (new IndexWidgets())->recAndPopProductsWidget('popular', 6);
$recProducts = (new IndexWidgets())->recAndPopProductsWidget('recommended');
$model->setData(['slides' => IndexWidgets::getSliderWidget(), 'currentCategory' => (new IndexWidgets())->currentCategoryWidget(Helper::getSiteConfig()->currentCategoryWidget), 'popularProducts' => Generator::popularProducts($popProducts, 6), 'recommendedProducts' => Generator::recommendedProducts($recProducts)]);
$output = $model->render('../views/index.php', 'main');
$fc->setPage($output);
}
示例13: validator
/**
* Validates input before processing user requests
* @param Array $data array of fields to validate
* @param Array $rules array of rules to apply
* @return \Illuminate\Http\Response response if validation fails
*/
public static function validator(array $data, array $rules, $redirectRoute)
{
// Validate
$validator = Validator::make($data, $rules);
// If validator fails get the errors and warn the user
// this redirects to prevent further execution
if ($validator->fails()) {
$message = Helper::getValidationErrors($validator);
return redirect()->route($redirectRoute)->with('message', $message);
}
}
示例14: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
// dd(Helper::makePermissionsCRUD($request->privilege));
$array_of_permissions = Helper::makePermissionsCRUD($request->privilege);
foreach ($array_of_permissions as $key => $permission) {
$privilege = new Privilege();
$privilege->permission = $permission;
$privilege->status_id = 1;
$privilege->save();
}
return \Redirect::to('settings/roles');
}
示例15: start
public function start(Request $request)
{
if (empty(Session::get('session_id'))) {
Helper::saveSession();
} else {
$session = Session::get('session_id');
$existe = SaveSession::where('cookie', '=', $session)->first();
if (empty($existe)) {
Helper::saveSession();
}
}
return redirect('cuando-comes-fuera-de-casa-vas-a');
}