Všetci () v laraveli

Príklady kódu

8
0

laravel fillable

    /**
     * The attributes that are mass assignable.
     */
    protected $fillable = [
      					   'title',
                           'slug',
                           'body',
                           'image',
                           'published',
                           'comments_open'
                          ];
0
0

laravel zoznam modelov

<?php
// found link from https://stackoverflow.com/questions/34053585/how-do-i-get-a-list-of-all-models-in-laravel
// and then finally found on https://gist.github.com/mohammad425/231242958edb640601108bdea7bcf9ac
function getAllModels(): array
{
        $composer = json_decode(file_get_contents(base_path('composer.json')), true);
        $models = [];
        foreach ((array)data_get($composer, 'autoload.psr-4') as $namespace => $path) {
            $models = array_merge(collect(File::allFiles(base_path($path)))
                ->map(function ($item) use ($namespace) {
                    $path = $item->getRelativePathName();
                    return sprintf('\%s%s',
                        $namespace,
                        strtr(substr($path, 0, strrpos($path, '.')), '/', '\\'));
                })
                ->filter(function ($class) {
                    $valid = false;
                    if (class_exists($class)) {
                        $reflection = new \ReflectionClass($class);
                        $valid = $reflection->isSubclassOf(\Illuminate\Database\Eloquent\Model::class) &&
                            !$reflection->isAbstract();
                    }
                    return $valid;
                })
                ->values()
                ->toArray(), $models);
        }
        return $models;
}
0
0

laravel výrečný výplň

$flight->fill(['name' => 'Flight 22']);
0
0

všetci () v laraveli

all() is a static method on the Eloquent\Model.
All it does is create a new query object and call get() on it.
With all(), you cannot modify the query performed at all 
(except you can choose the columns to select by passing them as parameters).
get() is a method on the Eloquent\Builder object.

V iných jazykoch

Táto stránka je v iných jazykoch

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................