Home > PHP Framework > Laravel > body text

What is the difference between get and all in laravel?

WBOY
Release: 2022-02-18 10:34:00
Original
2920 people have browsed it

In laravel, both get and all can obtain the model. The difference is that all can obtain all models directly, while get obtains the model after adding many constraints. If no constraints are added in front of get, The effect is the same as all.

What is the difference between get and all in laravel?

#The operating environment of this article: Windows 10 system, Laravel version 6, Dell G3 computer.

What is the difference between get and all in laravel

get and all can get the model

all gets all directly, get gets the model after adding many constraints ,

If no constraints are added in front of get, the effect is the same as all

The example is as follows:

What is the difference between these two in laravel

$input = Input::get();
Copy after login

and

$input = Input::all();
Copy after login
public static function all()
{
   $input = array_merge(static::get(),static::query(),static::file());
   // ....
   return $input;
}
Copy after login

So all() calls get() and returns its contents as well as query() and file()$_FILES superglobal.

[Related recommendations: laravel Video tutorial

The above is the detailed content of What is the difference between get and all in laravel?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template