заполняемый laravel
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'title',
'slug',
'body',
'image',
'published',
'comments_open'
];
актуализация laravel от заявката
$affected = DB::table('users')
->where('id', 1)
->update(['votes' => 1]);
laravel създава или обновява
// 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]
);
обновете, или създайте laravel
$user = User::updateOrCreate(['name' => request()->name], [
'foo' => request()->foo
]);
актуализация laravel
$flight = App\Models\Flight::find(1);
$flight->name = 'New Flight Name';
$flight->save();
създаване или актуализиране на laravel
DB::table('vendor_managements')->where('vendor_code', $vendor_code)->update(array('state'=> $state_namne));
заявка за търсене laravel
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Flight extends Model
{
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'flight_id';
}