Skip to content

Commit

Permalink
Alpha sort import statements
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed Sep 12, 2019
1 parent 99aa1a4 commit 1b5d0e0
Showing 41 changed files with 161 additions and 164 deletions.
4 changes: 2 additions & 2 deletions api-authentication.md
Original file line number Diff line number Diff line change
@@ -39,8 +39,8 @@ Once the migration has been created, run the `migrate` Artisan command.

Once the `api_token` column has been added to your `users` table, you are ready to assign random API tokens to each user that registers with your application. You should assign these tokens when a `User` model is created for the user during registration. When using the [authentication scaffolding](/docs/{{version}}/authentication#authentication-quickstart) provided by the `laravel/ui` Composer package, this may be done in the `create` method of the `RegisterController`:

use Illuminate\Support\Str;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;

/**
* Create a new user instance after a valid registration.
@@ -79,8 +79,8 @@ For example, a controller method that initializes / refreshes the token for a gi

namespace App\Http\Controllers;

use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Illuminate\Support\Str;

class ApiTokenController extends Controller
{
4 changes: 2 additions & 2 deletions artisan.md
Original file line number Diff line number Diff line change
@@ -82,8 +82,8 @@ Let's take a look at an example command. Note that we are able to inject any dep

namespace App\Console\Commands;

use App\User;
use App\DripEmailer;
use App\User;
use Illuminate\Console\Command;

class SendEmails extends Command
@@ -151,8 +151,8 @@ The Closure is bound to the underlying command instance, so you have full access

In addition to receiving your command's arguments and options, command Closures may also type-hint additional dependencies that you would like resolved out of the [service container](/docs/{{version}}/container):

use App\User;
use App\DripEmailer;
use App\User;

Artisan::command('email:send {user}', function (DripEmailer $drip, $user) {
$drip->send(User::find($user));
14 changes: 6 additions & 8 deletions authentication.md
Original file line number Diff line number Diff line change
@@ -418,8 +418,8 @@ You may define your own authentication guards using the `extend` method on the `
namespace App\Providers;

use App\Services\Auth\JwtGuard;
use Illuminate\Support\Facades\Auth;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Auth;

class AuthServiceProvider extends ServiceProvider
{
@@ -491,9 +491,9 @@ If you are not using a traditional relational database to store your users, you

namespace App\Providers;

use Illuminate\Support\Facades\Auth;
use App\Extensions\RiakUserProvider;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Auth;

class AuthServiceProvider extends ServiceProvider
{
@@ -542,14 +542,13 @@ Let's take a look at the `Illuminate\Contracts\Auth\UserProvider` contract:

namespace Illuminate\Contracts\Auth;

interface UserProvider {

interface UserProvider
{
public function retrieveById($identifier);
public function retrieveByToken($identifier, $token);
public function updateRememberToken(Authenticatable $user, $token);
public function retrieveByCredentials(array $credentials);
public function validateCredentials(Authenticatable $user, array $credentials);

}

The `retrieveById` function typically receives a key representing the user, such as an auto-incrementing ID from a MySQL database. The `Authenticatable` implementation matching the ID should be retrieved and returned by the method.
@@ -571,15 +570,14 @@ Now that we have explored each of the methods on the `UserProvider`, let's take

namespace Illuminate\Contracts\Auth;

interface Authenticatable {

interface Authenticatable
{
public function getAuthIdentifierName();
public function getAuthIdentifier();
public function getAuthPassword();
public function getRememberToken();
public function setRememberToken($value);
public function getRememberTokenName();

}

This interface is simple. The `getAuthIdentifierName` method should return the name of the "primary key" field of the user and the `getAuthIdentifier` method should return the "primary key" of the user. In a MySQL back-end, again, this would be the auto-incrementing primary key. The `getAuthPassword` should return the user's hashed password. This interface allows the authentication system to work with any User class, regardless of what ORM or storage abstraction layer you are using. By default, Laravel includes a `User` class in the `app` directory which implements this interface, so you may consult this class for an implementation example.
14 changes: 7 additions & 7 deletions authorization.md
Original file line number Diff line number Diff line change
@@ -133,8 +133,8 @@ The gate methods for authorizing abilities (`allows`, `denies`, `check`, `any`,

So far, we have only examined gates that return simple boolean values. However, sometimes you may wish to return a more detail response, including an error message. To do so, you may return a `Illuminate\Auth\Access\Response` from your gate:

use Illuminate\Support\Facades\Gate;
use Illuminate\Auth\Access\Response;
use Illuminate\Support\Facades\Gate;

Gate::define('edit-settings', function ($user) {
return $user->isAdmin
@@ -208,10 +208,10 @@ Once the policy exists, it needs to be registered. The `AuthServiceProvider` inc

namespace App\Providers;

use App\Post;
use App\Policies\PostPolicy;
use Illuminate\Support\Facades\Gate;
use App\Post;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;

class AuthServiceProvider extends ServiceProvider
{
@@ -265,8 +265,8 @@ The `update` method will receive a `User` and a `Post` instance as its arguments

namespace App\Policies;

use App\User;
use App\Post;
use App\User;

class PostPolicy
{
@@ -351,8 +351,8 @@ By default, all gates and policies automatically return `false` if the incoming

namespace App\Policies;

use App\User;
use App\Post;
use App\User;

class PostPolicy
{
@@ -439,9 +439,9 @@ In addition to helpful methods provided to the `User` model, Laravel provides a

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Post;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class PostController extends Controller
{
@@ -489,9 +489,9 @@ The `authorizeResource` method accepts the model's class name as its first argum

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Post;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class PostController extends Controller
{
14 changes: 7 additions & 7 deletions broadcasting.md
Original file line number Diff line number Diff line change
@@ -137,11 +137,11 @@ When a user is viewing one of their orders, we don't want them to have to refres
namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Queue\SerializesModels;

class ShippingStatusUpdated implements ShouldBroadcast
{
@@ -199,11 +199,11 @@ The `ShouldBroadcast` interface requires you to implement a single method: `broa

use App\User;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Queue\SerializesModels;

class ServerCreated implements ShouldBroadcast
{
@@ -393,8 +393,8 @@ Finally, you may place the authorization logic for your channel in the channel c

namespace App\Broadcasting;

use App\User;
use App\Order;
use App\User;

class OrderChannel
{
2 changes: 1 addition & 1 deletion cache.md
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ You may also set the `host` option to a UNIX socket path. If you do this, the `p

#### Redis

Before using a Redis cache with Laravel, you will need to either install the PhpRedis PHP extension via PECL or install the `predis/predis` package (~1.0) via Composer .
Before using a Redis cache with Laravel, you will need to either install the PhpRedis PHP extension via PECL or install the `predis/predis` package (~1.0) via Composer.

For more information on configuring Redis, consult its [Laravel documentation page](/docs/{{version}}/redis#configuration).

6 changes: 3 additions & 3 deletions container.md
Original file line number Diff line number Diff line change
@@ -24,9 +24,9 @@ Let's look at a simple example:

namespace App\Http\Controllers;

use App\User;
use App\Repositories\UserRepository;
use App\Http\Controllers\Controller;
use App\Repositories\UserRepository;
use App\User;

class UserController extends Controller
{
@@ -140,10 +140,10 @@ This statement tells the container that it should inject the `RedisEventPusher`

Sometimes you may have two classes that utilize the same interface, but you wish to inject different implementations into each class. For example, two controllers may depend on different implementations of the `Illuminate\Contracts\Filesystem\Filesystem` [contract](/docs/{{version}}/contracts). Laravel provides a simple, fluent interface for defining this behavior:

use Illuminate\Support\Facades\Storage;
use App\Http\Controllers\PhotoController;
use App\Http\Controllers\VideoController;
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Support\Facades\Storage;

$this->app->when(PhotoController::class)
->needs(Filesystem::class)
2 changes: 1 addition & 1 deletion contracts.md
Original file line number Diff line number Diff line change
@@ -127,8 +127,8 @@ For example, take a look at this event listener:

namespace App\Listeners;

use App\User;
use App\Events\OrderWasPlaced;
use App\User;
use Illuminate\Contracts\Redis\Factory;

class CacheOrderInformation
4 changes: 2 additions & 2 deletions controllers.md
Original file line number Diff line number Diff line change
@@ -32,8 +32,8 @@ Below is an example of a basic controller class. Note that the controller extend

namespace App\Http\Controllers;

use App\User;
use App\Http\Controllers\Controller;
use App\User;

class UserController extends Controller
{
@@ -75,8 +75,8 @@ If you would like to define a controller that only handles a single action, you

namespace App\Http\Controllers;

use App\User;
use App\Http\Controllers\Controller;
use App\User;

class ShowProfile extends Controller
{
8 changes: 4 additions & 4 deletions database-testing.md
Original file line number Diff line number Diff line change
@@ -53,9 +53,9 @@ It is often useful to reset your database after each test so that data from a pr

namespace Tests\Feature;

use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Tests\TestCase;

class ExampleTest extends TestCase
{
@@ -79,8 +79,8 @@ It is often useful to reset your database after each test so that data from a pr

When testing, you may need to insert a few records into your database before executing your test. Instead of manually specifying the value of each column when you create this test data, Laravel allows you to define a default set of attributes for each of your [Eloquent models](/docs/{{version}}/eloquent) using model factories. To get started, take a look at the `database/factories/UserFactory.php` file in your application. Out of the box, this file contains one factory definition:

use Illuminate\Support\Str;
use Faker\Generator as Faker;
use Illuminate\Support\Str;

$factory->define(App\User::class, function (Faker $faker) {
return [
@@ -253,10 +253,10 @@ If you would like to use [database seeders](/docs/{{version}}/seeding) to popula

namespace Tests\Feature;

use Tests\TestCase;
use OrderStatusesTableSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use OrderStatusesTableSeeder;
use Tests\TestCase;

class ExampleTest extends TestCase
{
2 changes: 1 addition & 1 deletion database.md
Original file line number Diff line number Diff line change
@@ -116,8 +116,8 @@ To run a basic query, you may use the `select` method on the `DB` facade:

namespace App\Http\Controllers;

use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;

class UserController extends Controller
{
14 changes: 7 additions & 7 deletions dusk.md
Original file line number Diff line number Diff line change
@@ -188,9 +188,9 @@ To get started, let's write a test that verifies we can log into our application
namespace Tests\Browser;

use App\User;
use Tests\DuskTestCase;
use Laravel\Dusk\Chrome;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Laravel\Dusk\Chrome;
use Tests\DuskTestCase;

class ExampleTest extends DuskTestCase
{
@@ -257,8 +257,8 @@ If you would like to define a custom browser method that you can re-use in a var

namespace App\Providers;

use Laravel\Dusk\Browser;
use Illuminate\Support\ServiceProvider;
use Laravel\Dusk\Browser;

class DuskServiceProvider extends ServiceProvider
{
@@ -307,9 +307,9 @@ When your test requires migrations, like the authentication example above, you s
namespace Tests\Browser;

use App\User;
use Tests\DuskTestCase;
use Laravel\Dusk\Chrome;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Laravel\Dusk\Chrome;
use Tests\DuskTestCase;

class ExampleTest extends DuskTestCase
{
@@ -1340,10 +1340,10 @@ Once the component has been defined, we can easily select a date within the date

namespace Tests\Browser;

use Tests\DuskTestCase;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Laravel\Dusk\Browser;
use Tests\Browser\Components\DatePicker;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\DuskTestCase;

class ExampleTest extends DuskTestCase
{
Loading

0 comments on commit 1b5d0e0

Please sign in to comment.