заполняемый 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
$flight = App\Models\Flight::find(1);
$flight->name = 'New Flight Name';
$flight->save();
меко премахване на laravel
/** in migrations this changes need to
add for table we want to add soft delete (LARAVEL)*/
/** The migrations. START */
public function up()
{
Schema::table('users', function(Blueprint $table)
{
$table->softDeletes();
});
}
/** The migrations. END */
/** after adding softdelete you need to
point that column in table related model (LARAVEL)*/
/** The Model. START */
use Illuminate\Database\Eloquent\SoftDeletes;
class User extends Model {
use SoftDeletes;
protected $dates = ['deleted_at'];
}
/** The Model. END */
създаване или актуализиране на laravel
DB::table('vendor_managements')->where('vendor_code', $vendor_code)->update(array('state'=> $state_namne));
актуализация laravel
use App\Models\Flight;
$flight = Flight::find(1);
$flight->name = 'Paris to London';
$flight->save();