Commit f424b87a authored by Taylor Otwell's avatar Taylor Otwell

PSR-2 for app.

parent 76d4c11c
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring; use Illuminate\Foundation\Inspiring;
class Inspire extends Command { class Inspire extends Command
{
/** /**
* The console command name. * The console command name.
...@@ -28,5 +29,4 @@ class Inspire extends Command { ...@@ -28,5 +29,4 @@ class Inspire extends Command {
{ {
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL); $this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
} }
} }
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
use Illuminate\Console\Scheduling\Schedule; use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel { class Kernel extends ConsoleKernel
{
/** /**
* The Artisan commands provided by your application. * The Artisan commands provided by your application.
...@@ -25,5 +26,4 @@ class Kernel extends ConsoleKernel { ...@@ -25,5 +26,4 @@ class Kernel extends ConsoleKernel {
$schedule->command('inspire') $schedule->command('inspire')
->hourly(); ->hourly();
} }
} }
<?php namespace App\Events; <?php namespace App\Events;
abstract class Event { abstract class Event
{
// //
} }
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
use Exception; use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler { class Handler extends ExceptionHandler
{
/** /**
* A list of the exception types that should not be reported. * A list of the exception types that should not be reported.
...@@ -38,5 +39,4 @@ class Handler extends ExceptionHandler { ...@@ -38,5 +39,4 @@ class Handler extends ExceptionHandler {
{ {
return parent::render($request, $e); return parent::render($request, $e);
} }
} }
...@@ -5,7 +5,8 @@ use Validator; ...@@ -5,7 +5,8 @@ use Validator;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers; use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
class AuthController extends Controller { class AuthController extends Controller
{
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
...@@ -59,5 +60,4 @@ class AuthController extends Controller { ...@@ -59,5 +60,4 @@ class AuthController extends Controller {
'password' => bcrypt($data['password']), 'password' => bcrypt($data['password']),
]); ]);
} }
} }
...@@ -5,7 +5,8 @@ use Illuminate\Contracts\Auth\Guard; ...@@ -5,7 +5,8 @@ use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\PasswordBroker; use Illuminate\Contracts\Auth\PasswordBroker;
use Illuminate\Foundation\Auth\ResetsPasswords; use Illuminate\Foundation\Auth\ResetsPasswords;
class PasswordController extends Controller { class PasswordController extends Controller
{
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
...@@ -34,5 +35,4 @@ class PasswordController extends Controller { ...@@ -34,5 +35,4 @@ class PasswordController extends Controller {
$this->middleware('guest'); $this->middleware('guest');
} }
} }
...@@ -4,8 +4,7 @@ use Illuminate\Foundation\Bus\DispatchesCommands; ...@@ -4,8 +4,7 @@ use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController; use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Validation\ValidatesRequests;
abstract class Controller extends BaseController { abstract class Controller extends BaseController
{
use DispatchesCommands, ValidatesRequests; use DispatchesCommands, ValidatesRequests;
} }
<?php namespace App\Http\Controllers; <?php namespace App\Http\Controllers;
class HomeController extends Controller { class HomeController extends Controller
{
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
...@@ -32,5 +33,4 @@ class HomeController extends Controller { ...@@ -32,5 +33,4 @@ class HomeController extends Controller {
{ {
return view('home'); return view('home');
} }
} }
<?php namespace App\Http\Controllers; <?php namespace App\Http\Controllers;
class WelcomeController extends Controller { class WelcomeController extends Controller
{
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
...@@ -32,5 +33,4 @@ class WelcomeController extends Controller { ...@@ -32,5 +33,4 @@ class WelcomeController extends Controller {
{ {
return view('welcome'); return view('welcome');
} }
} }
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
use Illuminate\Foundation\Http\Kernel as HttpKernel; use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel { class Kernel extends HttpKernel
{
/** /**
* The application's global HTTP middleware stack. * The application's global HTTP middleware stack.
...@@ -28,5 +29,4 @@ class Kernel extends HttpKernel { ...@@ -28,5 +29,4 @@ class Kernel extends HttpKernel {
'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth', 'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
'guest' => 'App\Http\Middleware\RedirectIfAuthenticated', 'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
]; ];
} }
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
use Closure; use Closure;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
class Authenticate { class Authenticate
{
/** /**
* The Guard implementation. * The Guard implementation.
...@@ -32,19 +33,14 @@ class Authenticate { ...@@ -32,19 +33,14 @@ class Authenticate {
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
if ($this->auth->guest()) if ($this->auth->guest()) {
{ if ($request->ajax()) {
if ($request->ajax())
{
return response('Unauthorized.', 401); return response('Unauthorized.', 401);
} } else {
else
{
return redirect()->guest('auth/login'); return redirect()->guest('auth/login');
} }
} }
return $next($request); return $next($request);
} }
} }
...@@ -4,7 +4,8 @@ use Closure; ...@@ -4,7 +4,8 @@ use Closure;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
class RedirectIfAuthenticated { class RedirectIfAuthenticated
{
/** /**
* The Guard implementation. * The Guard implementation.
...@@ -33,12 +34,10 @@ class RedirectIfAuthenticated { ...@@ -33,12 +34,10 @@ class RedirectIfAuthenticated {
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
if ($this->auth->check()) if ($this->auth->check()) {
{
return new RedirectResponse(url('/home')); return new RedirectResponse(url('/home'));
} }
return $next($request); return $next($request);
} }
} }
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
use Closure; use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
class VerifyCsrfToken extends BaseVerifier { class VerifyCsrfToken extends BaseVerifier
{
/** /**
* Handle an incoming request. * Handle an incoming request.
...@@ -16,5 +17,4 @@ class VerifyCsrfToken extends BaseVerifier { ...@@ -16,5 +17,4 @@ class VerifyCsrfToken extends BaseVerifier {
{ {
return parent::handle($request, $next); return parent::handle($request, $next);
} }
} }
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
abstract class Request extends FormRequest { abstract class Request extends FormRequest
{
// //
} }
<?php namespace App\Jobs; <?php namespace App\Jobs;
abstract class Job { abstract class Job
{
// //
} }
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider { class AppServiceProvider extends ServiceProvider
{
/** /**
* Bootstrap any application services. * Bootstrap any application services.
...@@ -23,5 +24,4 @@ class AppServiceProvider extends ServiceProvider { ...@@ -23,5 +24,4 @@ class AppServiceProvider extends ServiceProvider {
{ {
// //
} }
} }
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract; use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider { class EventServiceProvider extends ServiceProvider
{
/** /**
* The event listener mappings for the application. * The event listener mappings for the application.
...@@ -28,5 +29,4 @@ class EventServiceProvider extends ServiceProvider { ...@@ -28,5 +29,4 @@ class EventServiceProvider extends ServiceProvider {
// //
} }
} }
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
use Illuminate\Routing\Router; use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider { class RouteServiceProvider extends ServiceProvider
{
/** /**
* This namespace is applied to the controller routes in your routes file. * This namespace is applied to the controller routes in your routes file.
...@@ -35,10 +36,8 @@ class RouteServiceProvider extends ServiceProvider { ...@@ -35,10 +36,8 @@ class RouteServiceProvider extends ServiceProvider {
*/ */
public function map(Router $router) public function map(Router $router)
{ {
$router->group(['namespace' => $this->namespace], function($router) $router->group(['namespace' => $this->namespace], function ($router) {
{
require app_path('Http/routes.php'); require app_path('Http/routes.php');
}); });
} }
} }
...@@ -6,7 +6,8 @@ use Illuminate\Auth\Passwords\CanResetPassword; ...@@ -6,7 +6,8 @@ use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
class User extends Model implements AuthenticatableContract, CanResetPasswordContract { class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
use Authenticatable, CanResetPassword; use Authenticatable, CanResetPassword;
...@@ -30,5 +31,4 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon ...@@ -30,5 +31,4 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
* @var array * @var array
*/ */
protected $hidden = ['password', 'remember_token']; protected $hidden = ['password', 'remember_token'];
} }
...@@ -29,7 +29,6 @@ require __DIR__.'/../vendor/autoload.php'; ...@@ -29,7 +29,6 @@ require __DIR__.'/../vendor/autoload.php';
$compiledPath = __DIR__.'/../storage/framework/compiled.php'; $compiledPath = __DIR__.'/../storage/framework/compiled.php';
if (file_exists($compiledPath)) if (file_exists($compiledPath)) {
{
require $compiledPath; require $compiledPath;
} }
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration { class CreateUsersTable extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
...@@ -12,8 +13,7 @@ class CreateUsersTable extends Migration { ...@@ -12,8 +13,7 @@ class CreateUsersTable extends Migration {
*/ */
public function up() public function up()
{ {
Schema::create('users', function(Blueprint $table) Schema::create('users', function (Blueprint $table) {
{
$table->increments('id'); $table->increments('id');
$table->string('name'); $table->string('name');
$table->string('email')->unique(); $table->string('email')->unique();
...@@ -32,5 +32,4 @@ class CreateUsersTable extends Migration { ...@@ -32,5 +32,4 @@ class CreateUsersTable extends Migration {
{ {
Schema::drop('users'); Schema::drop('users');
} }
} }
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreatePasswordResetsTable extends Migration { class CreatePasswordResetsTable extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
...@@ -12,8 +13,7 @@ class CreatePasswordResetsTable extends Migration { ...@@ -12,8 +13,7 @@ class CreatePasswordResetsTable extends Migration {
*/ */
public function up() public function up()
{ {
Schema::create('password_resets', function(Blueprint $table) Schema::create('password_resets', function (Blueprint $table) {
{
$table->string('email')->index(); $table->string('email')->index();
$table->string('token')->index(); $table->string('token')->index();
$table->timestamp('created_at'); $table->timestamp('created_at');
...@@ -29,5 +29,4 @@ class CreatePasswordResetsTable extends Migration { ...@@ -29,5 +29,4 @@ class CreatePasswordResetsTable extends Migration {
{ {
Schema::drop('password_resets'); Schema::drop('password_resets');
} }
} }
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class DatabaseSeeder extends Seeder { class DatabaseSeeder extends Seeder
{
/** /**
* Run the database seeds. * Run the database seeds.
...@@ -16,5 +17,4 @@ class DatabaseSeeder extends Seeder { ...@@ -16,5 +17,4 @@ class DatabaseSeeder extends Seeder {
// $this->call('UserTableSeeder'); // $this->call('UserTableSeeder');
} }
} }
...@@ -13,8 +13,7 @@ $uri = urldecode( ...@@ -13,8 +13,7 @@ $uri = urldecode(
// This file allows us to emulate Apache's "mod_rewrite" functionality from the // This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel // built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here. // application without having installed a "real" web server software here.
if ($uri !== '/' and file_exists(__DIR__.'/public'.$uri)) if ($uri !== '/' and file_exists(__DIR__.'/public'.$uri)) {
{
return false; return false;
} }
......
<?php <?php
class ExampleTest extends TestCase { class ExampleTest extends TestCase
{
/** /**
* A basic functional test example. * A basic functional test example.
...@@ -13,5 +14,4 @@ class ExampleTest extends TestCase { ...@@ -13,5 +14,4 @@ class ExampleTest extends TestCase {
$this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(200, $response->getStatusCode());
} }
} }
<?php <?php
class TestCase extends Illuminate\Foundation\Testing\TestCase { class TestCase extends Illuminate\Foundation\Testing\TestCase
{
/** /**
* Creates the application. * Creates the application.
...@@ -15,5 +16,4 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase { ...@@ -15,5 +16,4 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase {
return $app; return $app;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment