pingcrm/app/Model.php

21 lines
498 B
PHP
Raw Normal View History

2019-03-18 08:53:00 -03:00
<?php
namespace App;
2019-04-24 17:19:50 -03:00
use Illuminate\Database\Eloquent\Model as Eloquent;
2020-07-29 11:58:25 -03:00
use Illuminate\Database\Eloquent\SoftDeletes;
2019-03-18 08:53:00 -03:00
2019-04-24 17:19:50 -03:00
abstract class Model extends Eloquent
2019-03-18 08:53:00 -03:00
{
protected $guarded = [];
2019-04-24 17:19:50 -03:00
2019-04-23 12:49:12 -03:00
protected $perPage = 10;
2019-03-18 08:53:00 -03:00
public function resolveRouteBinding($value, $field = null)
2019-03-18 08:53:00 -03:00
{
2019-04-23 12:49:12 -03:00
return in_array(SoftDeletes::class, class_uses($this))
? $this->where($this->getRouteKeyName(), $value)->withTrashed()->first()
: parent::resolveRouteBinding($value);
2019-03-18 08:53:00 -03:00
}
}