Home >PHP Framework >Laravel >What is the difference between get and all in laravel?

What is the difference between get and all in laravel?

WBOY
WBOYOriginal
2022-02-18 10:34:002956browse

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();

and

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

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!

Statement:
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