Skip to content

Remove trailing whitespace and final new lines #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public function handle($request, Closure $next)
Second, register the created middleware in app/Http/Kernel.php file:

```php
protected $middlewareGroups = [
protected $middlewareGroups = [
'api' => [
\App\Http\Middleware\ForceJsonResponse::class,
],
Expand All @@ -255,12 +255,12 @@ Tip given by [Feras Elsharif](https://github.com/ferasbbm)

If you are working on a project that may have multi-release in the future or your endpoints have a breaking change like a change in the format of the response data, and you want to ensure that the API version remains functional when changes are made to the code.

#### Change The Default Route Files
#### Change The Default Route Files
The first step is to change the route map in the `App\Providers\RouteServiceProvider` file, so let's get started:

#### Laravel 8 and above:

Add a 'ApiNamespace' property
Add a 'ApiNamespace' property

```php
/**
Expand All @@ -279,7 +279,7 @@ $this->routes(function () {
->namespace($this->ApiNamespace.'\\V1')
->group(base_path('routes/API/v1.php'));
}

//for v2
Route::prefix('api/v2')
->middleware('api')
Expand All @@ -304,7 +304,7 @@ protected string $ApiNamespace = 'App\Http\Controllers\Api';
Inside the method map, add the following code:

```php
// remove this $this->mapApiRoutes();
// remove this $this->mapApiRoutes();
$this->mapApiV1Routes();
$this->mapApiV2Routes();
```
Expand Down Expand Up @@ -345,8 +345,8 @@ Controllers
```
routes
└── Api
│ └── v1.php
│ └── v2.php
│ └── v1.php
│ └── v2.php
└── web.php
```

Expand Down
2 changes: 1 addition & 1 deletion auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Gate::before(function (?User $user, $ability) {

Laravel's authentication system fires various events during the authentication process, allowing you to hook into these events and perform additional actions or custom logic.

For example, you might want to log users Login.
For example, you might want to log users Login.
You can achieve this by listening to the `Illuminate\Auth\Events\Login` event.

To implement it:
Expand Down
1 change: 0 additions & 1 deletion collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,3 @@ Collection::times(7, function ($number) {
```

Tip given by [@Teacoders](https://twitter.com/Teacoders/status/1509447909602906116)

4 changes: 2 additions & 2 deletions db-models-and-eloquent.md
Original file line number Diff line number Diff line change
Expand Up @@ -2199,14 +2199,14 @@ class CategoryController extends Controller
{
// instead of
$category = Category::where('name', $request->name)->first();

if (!$category) {
$category = Category::create([
'name' => $request->name,
'slug' => Str::slug($request->name),
]);
}

// you can use
$category = Category::firstOrCreate([
'name' => $request->name,
Expand Down
1 change: 0 additions & 1 deletion factories.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,3 @@ class EventSeeder extends Seeder
```

Tip given by [@justsanjit](https://twitter.com/justsanjit/status/1514428294418079746)

2 changes: 1 addition & 1 deletion log-and-debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ If you want to implement a new listener to a specific event but you don't know i

You can use the `\Illuminate\Support\Facades\Event::listen()` method on `boot()` method of `app/Providers/EventServiceProvider.php` to catch all events fired.

**Important:** If you use the `Log` facade within this event listener then you will need to exclude events named `Illuminate\Log\Events\MessageLogged` to avoid an infinite loop.
**Important:** If you use the `Log` facade within this event listener then you will need to exclude events named `Illuminate\Log\Events\MessageLogged` to avoid an infinite loop.
(Example: `if ($event == 'Illuminate\\Log\\Events\\MessageLogged') return;`)

```php
Expand Down
1 change: 0 additions & 1 deletion mail.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,3 @@ class InvoicePaid extends Notification
Use the `when` or `unless` methods in you own classes by using the `Illuminate\Support\Traits\Conditionable` trait

Tip given by [@Philo01](https://twitter.com/Philo01/status/1503302749525528582)

9 changes: 4 additions & 5 deletions migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ If you want to check what migrations are executed or not yet, no need to look at
Example result:

```
Migration name .......................................................................... Batch / Status
2014_10_12_000000_create_users_table ........................................................... [1] Ran
2014_10_12_100000_create_password_resets_table ................................................. [1] Ran
2019_08_19_000000_create_failed_jobs_table ..................................................... [1] Ran
Migration name .......................................................................... Batch / Status
2014_10_12_000000_create_users_table ........................................................... [1] Ran
2014_10_12_100000_create_password_resets_table ................................................. [1] Ran
2019_08_19_000000_create_failed_jobs_table ..................................................... [1] Ran
```

### Create Migration with Spaces
Expand Down Expand Up @@ -302,4 +302,3 @@ Schema::create('posts', function (Blueprint $table) {
```

Tip given by [@iamgurmandeep](https://twitter.com/iamgurmandeep/status/1517152425748148225)

1 change: 0 additions & 1 deletion models-relations.md
Original file line number Diff line number Diff line change
Expand Up @@ -680,4 +680,3 @@ select * from posts where user_id = ? and (active = 1 or votes >= 100)
```

Tip given by [@BonnickJosh](https://twitter.com/BonnickJosh/status/1494779780562096139)

3 changes: 1 addition & 2 deletions other.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class TerminatingMiddleware
{
return $next($request);
}

public function terminate($request, $response)
{
// ...
Expand Down Expand Up @@ -1522,4 +1522,3 @@ If you ever need to bypass database when a job fails, you can do one of the belo
Why you would want this? For applications where you do not need to store failed jobs and they needs to have very high TPS, skipping database can be very favourable as we are not hitting database, saving times & prevent database going down.

Tip given by [@a-h-abid](https://github.com/a-h-abid)

1 change: 0 additions & 1 deletion routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -674,4 +674,3 @@ Route::controller(UsersController::class)->group(function () {
```

Tip given by [@justsanjit](https://twitter.com/justsanjit/status/1514943541612527616)

1 change: 0 additions & 1 deletion validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -521,4 +521,3 @@ class RegistrationController extends Controller
```

Tip given by [@mattkingshott](https://twitter.com/mattkingshott/status/1518590652682063873)

1 change: 0 additions & 1 deletion views.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,4 +433,3 @@ This is going to be a nice addition that we can use to clean up our Blade views
```

Tip given by [@VijayGoswami](https://vijaygoswami.in)