Actualizar modelo laravel

Ejemplos de código

8
0

laravel rellenable

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

laravel crear o actualizar

// If there's a flight from Oakland to San Diego, set the price to $99.
// If no matching model exists, create one.
$flight = App\Models\Flight::updateOrCreate(
    ['departure' => 'Oakland', 'destination' => 'San Diego'],
    ['price' => 99, 'discounted' => 1]
);
3
0

actualización de laravel

$flight = App\Models\Flight::find(1);

$flight->name = 'New Flight Name';

$flight->save();
3
0

actualización de laravel

<!-mass update-->
App\Models\Flight::where('active', 1)
          ->where('destination', 'San Diego')
          ->update(['delayed' => 1]);
2
0

larave Soft Elimina

Schema::table('flights', function (Blueprint $table) {
    $table->softDeletes();
});
0
0

modelo php artisan make

php artisan make:model Flight

En otros idiomas

Esta página está en otros idiomas

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