本文整理汇总了PHP中Debugbar类的典型用法代码示例。如果您正苦于以下问题:PHP Debugbar类的具体用法?PHP Debugbar怎么用?PHP Debugbar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Debugbar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$rules = array('private' => 'numeric|required', 'title' => 'max:46|required', 'paste' => 'required', 'expire' => 'required|numeric', 'private' => 'required|numeric', 'tags' => 'max:6|alpha');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
$messages = $validator->messages();
return View::make('paste.form')->withErrors($messages);
}
$new_paste = new Paste();
$new_paste->title = Input::get('title');
$new_paste->token = Str::random(40);
$new_paste->delete_token = Str::random(40);
$new_paste->paste = Input::get('paste');
$new_paste->private = Input::get('private');
date_default_timezone_set('UTC');
$expire_time = date('Y-m-d H:i:s', strtotime(sprintf('now + %s minutes', Input::get('expire'))));
$new_paste->expire = $expire_time;
if (!$new_paste->save()) {
Debugbar::error('Saving failed!');
}
// Check if tags are set
if (Input::has('hidden-tags')) {
$tags = explode(' ', Input::get('hidden-tags'));
foreach ($tags as $key => $tag) {
$tag_model = new Tag();
$tag_model->tag = $tag;
$tag_model->paste_id = $new_paste->id;
$new_paste->tags()->save($tag_model);
}
}
if ($new_paste->id) {
return Redirect::route('paste.show', $new_paste->token)->withCookie(Cookie::make('edittoken', $new_paste->token, 30));
}
return view::make('paste.form', array('page_title' => 'Create a paste'));
}
示例2: traitEntityEdit
function traitEntityEdit()
{
//соберем форму
$this->traitEntityEdit_formBuild();
$this->form->initValues($this->model->toForm());
$this->traitEntityEdit_formBuildAfter();
if ($this->form->isSubmitted()) {
$model_class = static::getClassModel();
$data = $this->form->getValue();
$data['id'] = $this->model->id;
$validator = $model_class::getDataValidator($data, $this->form);
// dd($data);
if ($validator->validate()) {
//запись успешно сохранена
$this->traitEntity_save($validator);
//выведем сообщение об успешной вставке
return $this->traitEntityEdit_success();
} else {
\Debugbar::addMessage($validator->getErrors());
$this->form->setErrors($validator->getErrors());
//$this->form->putTbStatic(\HtmlDiv::addClass('alert alert-danger')->setContent($validator->getErrors(true)));
}
//запись успешно сохранена
// $this->traitEntity_save();
// выведем сообщение об успешной вставке
// return $this->traitEntityEdit_success();
}
//форма показана в первый раз или с ошибками
if (\Request::ajax()) {
return $this->traitEntityEditJson();
}
return $this->traitEntityEditHtml();
}
示例3: get
public function get($key)
{
$val = \App\Config::where('key', $key)->pluck('value');
\Debugbar::info($key . ' : ' . $val);
$val = unserialize($val);
return $val;
}
示例4: traitEntityAdd
function traitEntityAdd()
{
//соберем форму
$this->traitEntityAdd_formBuild();
$this->traitEntityAdd_formBuildAfter();
/** @var Model $model_class */
$model_class = static::getClassModel();
if ($this->form->isSubmitted()) {
$validator = $model_class::getDataValidator($this->form->getValue(), $this->form);
if ($validator->validate()) {
//запись успешно сохранена
$this->traitEntity_save($validator);
//выведем сообщение об успешной вставке
return $this->traitEntityAdd_success();
} else {
// dd($validator->getErrors());
\Debugbar::addMessage($validator->getErrors());
$this->form->setErrors($validator->getErrors());
}
} else {
$fill_labels = $this->model->getFillable();
foreach ($fill_labels as $fillable) {
if (null !== \Input::get($fillable)) {
$this->form->initValues([$fillable => \Input::get($fillable)]);
}
}
}
//форма показана в первый раз или с ошибками
if (\Request::ajax()) {
return $this->traitEntityAddJson();
} else {
return $this->traitEntityAddHtml();
}
}
示例5: getData
/**
* [getData]
* @return [type] [description]
*/
public function getData()
{
$Model = $this->modelName;
$all_reminders = $Model::all($this->dataTableColumns);
$data = [];
foreach ($all_reminders as $reminder) {
// load relations
$load_curr_project = $reminder->project;
$load_curr_user = $reminder->user;
$curr_reminder = $reminder;
Debugbar::info($reminder);
if (isset($reminder->user_id) && isset($reminder->project_id)) {
$curr_proj = (object) ['id' => $reminder->reminder_id, 'name' => $reminder->project->name];
$curr_user = (object) ['id' => $reminder->user_id, 'username' => $reminder->user->username];
$curr_entry = (object) ['DT_RowId' => 'row_' . $reminder->id, 'reminders' => $curr_reminder, 'users' => $curr_user, 'projects' => $curr_proj];
$data[] = $curr_entry;
}
}
$all_projects = Project::orderBy('name', 'DESC')->get(['id', 'name']);
$projects = [];
foreach ($all_projects as $project) {
$tmp_project = (object) ['value' => $project->id, 'label' => $project->name];
$projects[] = $tmp_project;
}
$all_users = User::all(['id', 'username']);
$users = [];
foreach ($all_users as $user) {
$tmp_user = (object) ['value' => $user->id, 'label' => $user->username];
$users[] = $tmp_user;
}
$ret = ['data' => $data, 'projects' => $projects, 'users' => $users];
return Response::json($ret);
}
示例6: getUserByCredential
/**
* @param $password
* @param $loginName
* @param bool $flag
* @return Users
*/
public function getUserByCredential($password, $loginName, $flag = null)
{
if ($flag == null) {
$flag = false;
}
\Debugbar::info($flag);
// TODO: Implement getUserByCredential() method.
if (!$flag) {
$user = $this->model->newQuery()->with('getGroup')->where('email', '=', $loginName)->where('ugroup', '!=', 2)->where('Active', '=', 1)->first();
if ($user != null) {
if (\Hash::check($password, $user->getPassword())) {
\Debugbar::addMessage('hash matches - ' . Hash::make($password));
return $user;
} else {
\Debugbar::addMessage('hash dose not match');
return null;
}
} else {
return null;
}
} else {
$user = $this->model->newQuery()->with('getGroup')->where('Password', '=', $password)->where('email', '=', $loginName)->where('Active', '=', 1)->first();
if ($user != null) {
return $user;
} else {
return null;
}
}
}
示例7: index
public function index()
{
$this->data['personales'] = Personal::where('tipoPersonal', '=', 'Voluntario')->get();
$this->data['personalVoluntarioActive'] = 'active';
Debugbar::info($this->data['personales']);
return View::make('admin.personalVoluntario.index', $this->data);
}
示例8: update
public function update($id)
{
$user = User::find($id);
if (!$user) {
return $this->store();
}
$data = Input::all();
if (!isset($data['username'])) {
$data['username'] = $data['gebruikersnaam'];
}
if ($data['username'] == $user->username) {
unset($data['username']);
}
$validator = Validator::make($data, User::$rulesUpdate);
$validator->sometimes('function', 'unique:users', function ($input) {
return $input->function != "";
});
if ($validator->fails()) {
Session::flash('error', 'Er waren fouten met het opslaan');
Debugbar::log($validator->messages());
return Redirect::action('user.edit', $id)->withErrors($validator)->withInput();
} else {
$user->username = Input::get('username');
$user->function = Input::get('function');
$user->save();
Session::flash('success', 'Gebruiker is aangepast!');
return Redirect::action('user.edit', $id);
}
}
示例9: console
public static function console($var)
{
if (!class_exists('Debugbar') || app()->environment() === 'testing') {
return;
}
\Debugbar::addMessage($var);
}
示例10: boot
public function boot()
{
$this->loadViewsFrom(realpath(__DIR__ . '/../views'), 'maikblog');
$this->publishes([realpath(__DIR__ . '/../views') => base_path('resources/views/vendor/maikblog')]);
$this->setupRoutes($this->app->router);
// this for conig
$this->publishes([__DIR__ . '/config/maikblog.php' => config_path('maikblog.php')], 'config');
//this for migrations
$this->publishes([__DIR__ . '/database/migrations/' => database_path('migrations')], 'migrations');
//this for css and js
$this->publishes([realpath(__DIR__ . '/../assets') => public_path('maiklez/maikblog')], 'public');
\Validator::extend('tag_rule', function ($attribute, $value, $parameters) {
$tags = explode(',', $value);
// remove empty items from array
$tags = array_filter($tags);
// trim all the items in array
$tags = array_map('trim', $tags);
\Debugbar::info($tags);
foreach ($tags as $tag) {
if ($tag === "") {
return false;
}
}
return true;
});
\Validator::replacer('tag_rule', function ($message, $attribute, $rule, $parameters) {
return str_replace("no white spaces are allow");
});
}
示例11: index
public function index()
{
$this->data['personales'] = Personal::all();
$this->data['personalActive'] = 'active';
Debugbar::info($this->data['personales']);
return View::make('admin.personal.index', $this->data);
}
示例12: index
/**
* Display a list of all blog post to admin.
*
* @param Request $request
* @return Response
*/
public function index(Request $request)
{
$posts = Post::all();
$bestTag = Tag::with('postCount')->get()->sortByDesc('postCount');
$bestCat = Category::with('postCount')->get()->sortByDesc('postCount');
\Debugbar::info($bestTag);
return view('maikblog::table', ['posts' => $posts, 'best_tag' => $bestTag, 'best_cat' => $bestCat]);
}
示例13: upload
/**
* Method for upload files
*
* @param Request $request
* @param MediaRepositoryInterface $repositoryInterface
* @return string
*/
public function upload(Request $request, MediaRepositoryInterface $repositoryInterface)
{
\Debugbar::disable();
$id = $repositoryInterface->create($request->file('file'), null, null);
$answer = array('answer' => 'File transfer completed', 'id' => $id);
$json = json_encode($answer);
return $json;
}
示例14: index
public function index()
{
$this->data['beneficiarios'] = Beneficiario::all();
$this->data['responsables'] = Personal::where('tipoPersonal', '=', '');
Debugbar::info($this->data['beneficiarios']);
$this->data['beneficiariosActive'] = 'active';
return View::make('admin.beneficiarios.index', $this->data);
}
示例15: subtest
public function subtest()
{
$localeCode = LaravelLocalization::getCurrentLocale();
$urltrans = trans('test::routes.subtest');
\Debugbar::info($urltrans);
$test = LaravelLocalization::getLocalizedURL($localeCode, route('test'));
\Debugbar::info($test);
return '<p>Sub-test</p><p><b>Language</b>: ' . $localeCode . '</p><p>Our translation url: ' . $urltrans . '</p>';
}