eightminuseight icon

Laravel Basic Model

eightminuseight | PRO | 02/11/16 09:11:50 PM UTC | 0 ⭐ | 222 👁️ | Never ⏰ | []
PHP |

990 B

|

None

|

0 👍

/

0 👎

<?php
 
namespace App\Models;
 
use App\Models\User;
use Illuminate\Database\Eloquent\Model as Model;
 
/**
 * App\Models\Sample
 *
 * @property integer $id
 * @property string $name
 * @property \Carbon\Carbon $created_at
 * @property \Carbon\Carbon $updated_at
 */
class Sample extends \Eloquent
{
 
    /**
     * Database table name
     * @var string
     */
    public $table = "samples";
 
    /**
     * Table uses Laravel timestampa
     */
    public $timestamps = false;
 
 
 
    public $fillable = [
        "name",
    ];
 
 
    public $guarded = [];
 
    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        "id" => "integer",
        "name" => "string"
    ];
 
    public static $rules = [
 
    ];
 
 
 
    /*        _________________
    _________/   Relations     \_________________________________________________________________*/
 
    public function users() {
        return $this->hasMany(User::class, 'sample_id', 'id');
    }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
}

Comments