Questions tagged [laravel-7]

Laravel 7 is the previous stable version of the open-source PHP web framework created by Taylor Otwell. It was released on March 3, 2020. Please use the [laravel] tag for general Laravel-related questions.

Laravel 7 continues the improvements made in Laravel 6.x by introducing Laravel Sanctum, routing speed improvements, custom Eloquent casts, Blade component tags, fluent string operations, a developer-focused HTTP client, first-party CORS support, improved scoping for route model binding, stub customization, database queue improvements, multiple mail drivers, query-time casts, a new artisan test command, and a variety of other bug fixes and usability improvements.


New features overview:

  • Laravel Airlock

Laravel Airlock provides a featherweight authentication system for SPAs (single-page applications), mobile applications, and simple, token-based APIs. Airlock allows each user of your application to generate multiple API tokens for their account. In addition, these tokens may be granted abilities/scopes which specify which actions the tokens are allowed to perform.

  • Custom Eloquent Casts

Laravel has various built-in, helpful cast types; however, you may occasionally need to define your cast types. You may now accomplish this by defining a class that implements the CastsAttributes interface.

Classes that implement this interface must define get and set methods. The get method is responsible for transforming a raw value from the database into a cast value, while the set method should transform a cast value into a raw value that can be stored in the database.

  • Blade Component Tags & Improvements

Blade components have been overhauled for tag-based rendering, attribute management, component classes, and inline view components. Since the overhaul of Blade components is so extensive, please consult the complete Blade component documentation to learn about this feature.

  • HTTP Client

Laravel now provides an expressive, minimal API around the Guzzle HTTP client, allowing you to quickly make outgoing HTTP requests to communicate with other web applications. Laravel’s wrapper around Guzzle is focused on its most common use cases and an excellent developer experience.

  • Route Caching Speed Improvements

Laravel 7 includes a new method of matching compiled, cached routes that have been cached using the route:cache Artisan command. On large applications (for example, applications with 800 or more routes), these improvements can result in a 2x speed improvement in requests per second on a simple “Hello World” benchmark. Again, no changes to your application are required.

2270 questions
51
votes
1 answer

Laravel Sanctum vs Passport

What are the differences between these 2? And which one is better for a simple VueJS app? I've read their documents a few times but still confused. Thank you very much.
Daniel
  • 840
  • 1
  • 8
  • 9
42
votes
10 answers

LogicException: Please make sure the PHP Redis extension is installed and enabled

Laravel Version: 7.5.0 PHP Version: 7.2 Database Driver & Version: Redis Everything was working fine but suddenly this error appear i changed the phpredis to predis but error is same. Steps To Reproduce: I am calling the event function event(new…
UMAIR ALI
  • 1,055
  • 5
  • 14
  • 25
24
votes
7 answers

Any AWS EB Laravel route getting 404 Not Found nginx/1.16.1

I've just deploy a new laravel 7 application on AWS Elastic beanstalk. I've noticed they changed the Apache server to Nginx server. https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platform-history-php.html This is my api backend URL:…
Felipe Neuhauss
  • 341
  • 1
  • 2
  • 6
23
votes
9 answers

Getting 401 unauthorized for Laravel sanctum

I am using Laravel Sanctum with Vuejs SPA. Both reside on same top level domain Laravel backend : app.demo.localhost Vue SPA : app-spa.demo.localhost Login and logout (endpoints) are working correctly when called from VueJS SPA using axios and…
19
votes
9 answers

Laravel eloquent api resource remove `data` key (no collection)

I have custom eloquent api resource for user. For example when I use this resource Code $user = $request->user(); return new UserResource($user); Then on response I get: { "data": { "name": "Margarete Daniel", "email":…
Andreas Hunter
  • 4,504
  • 11
  • 65
  • 125
16
votes
1 answer

Wrong timezone in Laravel 7 after date serialization

I'm working on a new Laravel 7.1 app (Not an upgrade) But it seems that working with dates serialization loose the timezone. config/app.php 'timezone' => 'Europe/Zurich', tinker example >>> \Carbon\Carbon::parse('2020-06-22')->timezone =>…
Clément Baconnier
  • 5,718
  • 5
  • 29
  • 55
15
votes
1 answer

Laravel 7.x: Difference between fresh and refresh method?

While I was reading Laravel documentation, I faced a method named fresh and refresh on the Eloquent model. Please explain the major difference between them? I am having hard time understanding those.
Gursewak Singh
  • 642
  • 1
  • 7
  • 20
15
votes
2 answers

Expected response code 250 but got code "550", with message "550 5.7.1 Relaying denied "

I am getting this error Expected response code 250 but got code "550", with message "550 5.7.1 Relaying denied " when I try using mailgun and laravel 7 to send emails. But I do not know what to do
Tula
  • 189
  • 1
  • 1
  • 7
13
votes
2 answers

Laravel 8 factory state afterCreating

Laravel 7 factories had method afterCreatingState() where you could define what should happen after Model with specific state was saved into database. $factory->afterCreatingState(App\User::class, 'active', function ($user, $faker) { //…
Nebster
  • 884
  • 1
  • 11
  • 19
12
votes
3 answers

laravel/ui[v3.2.0, ..., 3.x-dev] require illuminate/console ^8.0

I try to install: composer require laravel/ui But i Keep receive this error: laravel/ui[v3.2.0, ..., 3.x-dev] require illuminate/console ^8.0 -> found illuminate/console[v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts…
kiana.ka
  • 509
  • 2
  • 5
  • 13
11
votes
2 answers

Laravel 7 - Stop Processing Jobs and Clear Queue

I have a production system on AWS and use Laravel Forge. There is a single default queue that is processing Jobs. I've created a number jobs and now wish to delete them (as they take many hours to complete and I realize my input data was bad). I…
BizzyBob
  • 12,309
  • 4
  • 27
  • 51
11
votes
3 answers

Laravel 7 - Scoping problem in Nested Resource Route

Routes: I have a nested resource route definition like this: Route::resource('posts.comments', 'CommentController'); That produces the following…
N'Bayramberdiyev
  • 5,936
  • 7
  • 27
  • 47
10
votes
1 answer

Empty tag doesn't work in some browsers warning in PhpStorm (Laravel 7)

When I want to use Laravel 7 component, the PhpStorm shows an annoying warning. How could I fix such behavior or disable this warning?
rela589n
  • 817
  • 1
  • 9
  • 19
10
votes
6 answers

Laravel 6-7 How Can I Override/Change a Vendor Class?

I recently ran into a problem where I need to change one of Laravel's vendor files to get a desired result. That file is vendor/laravel/framework/Illuminate/Routing/CompileRouteCollection.php. Inside that file, a function needs to be…
Tyler Shannon
  • 279
  • 1
  • 4
  • 16
8
votes
4 answers

How to pass boolean values from Blade to Vue Component Laravel 7?

I'm trying to implement IF condition with true/false or 1/0 in Vue Component. I go through some earlier asked questions but not able to get it. Please help me out. IF condition not gives true output even if dd gives true. Controller (I tried with…
Daljit Singh
  • 270
  • 3
  • 10
1
2 3
99 100