コード例 #1
0
ファイル: PasteController.php プロジェクト: dwbfox/pasteboard
 /**
  * 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
0
ファイル: AdminLogin.php プロジェクト: mj1618/punto-cms
 private static function checkLaravelCookie()
 {
     $cv = Request::cookie('laravel-remember');
     \Debugbar::error("laravel cookie: {$cv}");
     $uc = UserCookie::where('cookie', '=', $cv)->get()->first();
     if ($uc != null) {
         $user = User::where('id', '=', $uc->user_id)->get()->first();
         Auth::login($user);
     }
 }
コード例 #3
0
 public function root()
 {
     $items = ['Pack luggage', 'Go to airport', 'Arrive in San Juan'];
     // return $items;
     // \Log::debug($items);
     // 1 \Log::info('Just an informational message.');
     // 2 \Log::warning('Something may be going wrong.');
     // 3 \Log::error('Something is definitely going wrong.');
     // 4 \Log::critical('Danger, Will Robinson! Danger!');
     \Debugbar::error('Something is definitely going wrong.');
     return view('welcome');
 }
コード例 #4
0
 public function index()
 {
     \Redis::set('name', 'alegriaghost');
     $name = \Redis::get('name');
     \Redis::del('name');
     \Debugbar::info($name);
     \Debugbar::warning($name);
     \Debugbar::error($name);
     \Debugbar::addMessage($name, '$name');
     var_dump($name);
     \Redis::set('name1', 'alegriaghost1');
     \Redis::set('name2', 'alegriaghost2');
     \Redis::set('name3', 'alegriaghost3');
     $list = Redis::keys('*');
     $values = Redis::mget($list);
     var_dump($list);
     var_dump($values);
 }
コード例 #5
0
ファイル: routes.php プロジェクト: eldaronco/p4
// Login and register
# Show login form
Route::get('/login', 'Auth\\AuthController@getLogin');
# Process login form
Route::post('/login', 'Auth\\AuthController@postLogin');
# Process logout
Route::get('/logout', 'Auth\\AuthController@getLogout');
# Show registration form
Route::get('/register', 'Auth\\AuthController@getRegister');
# Process registration form
Route::post('/register', 'Auth\\AuthController@postRegister');
// Debugging
Route::get('/practice', function () {
    $data = array('foo' => 'bar');
    Debugbar::info($data);
    Debugbar::error('Error!');
    Debugbar::warning('Watch out…');
    Debugbar::addMessage('Another message', 'mylabel');
    return 'Practice';
});
Route::get('/confirm-login-worked', function () {
    # You may access the authenticated user via the Auth facade
    $user = Auth::user();
    if ($user) {
        echo 'You are logged in.';
        dump($user->toArray());
    } else {
        echo 'You are not logged in.';
    }
    return;
});
コード例 #6
0
 public function index()
 {
     $items = array('items' => ['Pack luggage', 'Go to airport', 'Arrive in San Juan']);
     \Debugbar::error('Something is definitely going wrong.');
     return view('welcome');
 }
コード例 #7
0
ファイル: routes.php プロジェクト: abougeniere/learn
<?php

/*
|--------------------------------------------------------------------------
| 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.
|
*/
get('users', 'UsersController@getInfos');
post('users', 'UsersController@postInfos');
Route::get('/', function () {
    $url = url('foo');
    \Debugbar::error($url);
    return view('welcome');
});
Route::get('/test', function () {
    return view('test.welcome');
});
Route::get('user/{id}', function ($id) {
    return 'User ' . $id;
});
コード例 #8
0
ファイル: global.php プロジェクト: fabyo/Skeleton_Laravel
| exceptions. If nothing is returned, the default error view is
| shown, which includes a detailed stack trace during debug.
|
*/
App::error(function (Exception $exception, $code) {
    $pathInfo = Request::getPathInfo();
    $message = $exception->getMessage() ?: 'Exception';
    $previous = URL::previous();
    $url = Request::fullUrl();
    if ($code == 404) {
        Log::error("{$code} - {$message} @ ({$pathInfo}) | {$url} (ref: {$previous})");
        Debugbar::error("{$code}, PathInfo = {$pathInfo} | fullUrl = {$url}");
        return View::make('errors.404');
    } else {
        Log::error("{$code} - {$message} @ {$pathInfo} (ref: {$previous})\r\n{$exception}");
        Debugbar::error("{$code}, {$message} @ {$pathInfo} | \r\n{$exception}");
    }
});
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenance mode is in effect for the application.
|
*/
App::down(function () {
    return Response::make("Be right back!", 503);
});