Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Http\Controllers\Masters\Barang;
- use Illuminate\Database\Eloquent\Model;
- use Auth;
- /**
- * App\Http\Controllers\Masters\Barang
- *
- * @property integer $id
- */
- class Barang extends Model {
- public static $singleKey = "barang";
- public static $multiKey = "barangs";
- public static $searchParams = ["tipe", "harga_modal", "harga_sub", "harga_jual", "sell_out", "promo", "stok", "keterangan", "image_type", "image", "m_merk_id", "m_jenis_id", "aktif"];
- protected $table = 'm_barang';
- protected $fillable = ["tipe", "harga_modal", "harga_sub", "harga_jual", "sell_out", "promo", "stok", "keterangan", "image_type", "image", "m_merk_id", "m_jenis_id", "aktif"];
- protected static function boot() {
- parent::boot();
- static::creating(function ($model) {
- $model->created_by = Auth::check() ? Auth::user()->nama : 'Ryner';
- $model->updated_by = Auth::check() ? Auth::user()->nama : 'Ryner';
- });
- static::updating(function ($model) {
- $model->updated_by = Auth::check() ? Auth::user()->nama : 'Ryner';
- });
- }
- public function merk() {
- return $this->belongsTo('App\Http\Controllers\Masters\Merk\Merk', 'm_merk_id');
- }
- }
Add Comment
Please, Sign In to add comment