mercredi 29 novembre 2017

Laravel / Eloquent - Prevent "deleted_at" Column From Being Returned by get() Method

I have a model that looks like:

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Location extends Model{

    use SoftDeletes;

    // Name of our database table
    protected $table = 'locations';

    // Column for soft deletes
    protected $dates = ['deleted_at'];

    // Columns that are mass assignable
    protected $fillable = ['name', 'address', 'city'];

}

When I call Location::get(), the deleted_at column is returned by default.

How do I prevent this column from being returned without explicitly specifying it?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2An5JdD
via IFTTT

Aucun commentaire:

Enregistrer un commentaire