Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Http\Controllers\Masters\Merk;
- use Illuminate\Database\Eloquent\Model;
- use Auth;
- /**
- * App\Http\Controllers\Masters\Merk
- *
- * @property integer $id
- */
- class Merk extends Model {
- public static $singleKey = "merk";
- public static $multiKey = "merks";
- public static $searchParams = ["nama", "aktif"];
- protected $table = 'm_merk';
- protected $fillable = ['nama', '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 barang() {
- return $this->hasMany('App\Http\Controllers\Masters\Barang\Barang');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment