Home > Article > PHP Framework > What is the difference between get and all in laravel?
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.
#The operating environment of this article: Windows 10 system, Laravel version 6, Dell G3 computer.
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!