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
0
votes
3 answers

Model binding for JSON api using Laravel

We are moving an older PHP project over to laravel. We are trying to post JSON to our api we created, but are not aware how to have the JSON be bound to a model. We added the model as a parameter to the function, it is created but none of the…
John C
  • 1,761
  • 2
  • 20
  • 30
0
votes
1 answer

How to send body request as string in Laravel 7?

My situation is using Laravel 7 want to use Shopee API Sending a request in Laravel should be like this $res = Http::withHeaders([ 'Content-Type' => 'application/json', 'Authorization' => $secret_key ])->post($api_url, [ …
Kmp
  • 15
  • 6
0
votes
0 answers

laravel aws serverless after login expired 419

I have Laravel 7 bref deploy to aws serverless. after login, laravel create 3 session to database session but the result show 419 page expired (SESSION_DRIVER=database). tried using the SESSION_DRIVER=cookie, but the result is still the same 419…
Gzai Kun
  • 148
  • 1
  • 12
0
votes
1 answer

Laravel Eloquent get model with double belongsTo relationship

I'm having a Model ToGoSubscriptions with belongsTo relationship to two other models, PhoneNumber and ToGoDevice. Both PhoneNumber and ToGoDevice haveMany ToGoSubscription. I have a PhoneNumber and a ToGoDevice, what I need to do is retrieve a…
Kha Kali
  • 169
  • 2
  • 13
0
votes
1 answer

How to utilize Laravel Cache in API?

In my company we have a three user roles: admin, physician and client. All of them can view one of the records table where we have about 1 million rows and we are in need of caching the results from database. I've read 10's of posts on Stack and…
z0mbieKale
  • 969
  • 1
  • 14
  • 44
0
votes
1 answer

Retrieving JSON content

i am a beginner on laravel. i have problem on creating my POST API. i want to use data retrieved from json POST from other application. but it always return null so i did some investigating on the request. when i return dd($request), the result…
fmg
  • 3
  • 3
0
votes
1 answer

Laravel 7 mysql union query

I am building a Laravel 7 app and trying to create a complex query using UNION which I think is what I want to do. Here is what I want to do: I want to query the users table where the column roleid = 0 , I then want to query the client_profiles…
Jayreis
  • 253
  • 1
  • 7
  • 28
0
votes
1 answer

PayPal SandBox in Laravel

My SandBox settings are like below My .env code is like…
abu abu
  • 6,599
  • 19
  • 74
  • 131
0
votes
1 answer

When I Trying to create a new User I cannot

I trying to make a CRUD called Usuarios(Users) with a foreing key from the table Perfiles(profiles) , the foreing key is the id from Profiles, but I donot know how to make it with a select tHIS IS MY FORM.BLADE.PHP @foreach…
0
votes
2 answers

Laravel/Eloquent, retrieve data dynamically (whereIn, sum)

I am pretty noob in Laravel, and I would like to retrieve data from DB in an "automated" way. I have a query that get the value of key "cases" where 'state' is the latest repeated $pieWyoming=State::select('cases')->where('state', '=',…
joecort
  • 3
  • 3
0
votes
1 answer

Laravel Large CSV import using maatwebsite excel

I have a CSV file with 30 k rows. I have used maatwebsite excel to import CSV in my pgsql database. Problem is every time it's uploading 10k-12k data in database, then page giving HTTP ERROR 500 Error : This page isn’t working localhost is currently…
Niloy Rony
  • 602
  • 1
  • 8
  • 23
0
votes
0 answers

Method App\\Http\\Controllers\\Controller::show does not exist

I just have upgraded one of my project from laravel version 5.2 to 7.1 But now I have started getting following error Method App\\Http\\Controllers\\Controller::show does not exist. I know there is not a function named show in my controller class.…
Mind Gauge
  • 39
  • 1
  • 1
  • 4
1 2 3
99
100