2019-03-18 08:53:00 -03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App;
|
|
|
|
|
2019-04-23 12:49:12 -03:00
|
|
|
use Illuminate\Database\Eloquent\Model as BaseModel;
|
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
2019-03-18 08:53:00 -03:00
|
|
|
|
2019-04-23 12:49:12 -03:00
|
|
|
abstract class Model extends BaseModel
|
2019-03-18 08:53:00 -03:00
|
|
|
{
|
|
|
|
protected $guarded = [];
|
2019-04-23 12:49:12 -03:00
|
|
|
|
|
|
|
protected $perPage = 10;
|
2019-03-18 08:53:00 -03:00
|
|
|
|
|
|
|
public function resolveRouteBinding($value)
|
|
|
|
{
|
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
|
|
|
}
|
|
|
|
}
|