Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Письменов Дмитрий Иванович
/
yourroomads
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0bf98f84
authored
Apr 24, 2019
by
Jonathan Reinink
Committed by
GitHub
Apr 24, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16 from dbpolito/patch-1
Improving Model
2 parents
6e757083
e576fdff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
app/Model.php
app/Model.php
View file @
0bf98f8
...
...
@@ -2,20 +2,19 @@
namespace
App
;
use
Illuminate\
Support\Facades\App
;
use
Illuminate\Database\Eloquent\
Model
as
Eloquent
;
use
Illuminate\
Database\Eloquent\Model
as
BaseModel
;
use
Illuminate\Database\Eloquent\
SoftDeletes
;
abstract
class
Model
extends
Eloquent
abstract
class
Model
extends
BaseModel
{
protected
$guarded
=
[];
public
function
getPerPage
()
{
return
10
;
}
protected
$perPage
=
10
;
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
);
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment