commit
0bf98f847c
|
@ -2,20 +2,19 @@
|
||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\App;
|
use Illuminate\Database\Eloquent\Model as BaseModel;
|
||||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
abstract class Model extends Eloquent
|
abstract class Model extends BaseModel
|
||||||
{
|
{
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
public function getPerPage()
|
protected $perPage = 10;
|
||||||
{
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function resolveRouteBinding($value)
|
public function resolveRouteBinding($value)
|
||||||
{
|
{
|
||||||
return $this->where('id', $value)->withTrashed()->first() ?? App::abort(404);
|
return in_array(SoftDeletes::class, class_uses($this))
|
||||||
|
? $this->where($this->getRouteKeyName(), $value)->withTrashed()->first()
|
||||||
|
: parent::resolveRouteBinding($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue