Skip to content
This repository was archived by the owner on Jun 12, 2018. It is now read-only.

Commit 8f2acea

Browse files
committed
Remove hacky where function
Because it has been possible to do this in a clear way, since this PR was merged: laravel/framework#20618
1 parent 676cd01 commit 8f2acea

File tree

2 files changed

+28
-45
lines changed

2 files changed

+28
-45
lines changed

composer.lock

Lines changed: 26 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/HasHashSlug.php

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ public function getRouteKey() {
9898
}
9999

100100
/**
101-
* Used in explicit model binding if no callback
101+
* Used in implicit model binding AND
102+
* used in explicit model binding if no callback
102103
* is specified, eg: Route::model('post', Post::class)
103104
*
104105
* @param string $slug
@@ -109,26 +110,6 @@ public function resolveRouteBinding($slug){
109110
return parent::where($this->getKeyName(), $id)->first();
110111
}
111112

112-
/**
113-
* Terrible hack to make automatic implicit route model binding possible
114-
*
115-
* @see \Illuminate\Routing\ImplicitRouteBinding::resolveForRoute
116-
*
117-
* @param string|array|\Closure $column
118-
* @param string $operator
119-
* @param mixed $value
120-
* @param string $boolean
121-
* @return \Illuminate\Database\Query\Builder
122-
*/
123-
public function where(... $arguments){
124-
if($arguments[0] == 'hashslug'){
125-
$id = static::decodeSlug($arguments[1]);
126-
return parent::where($this->getKeyName(), $id);
127-
}else{
128-
return parent::where(... $arguments);
129-
}
130-
}
131-
132113
/**
133114
* Decodes slug to id
134115
* @param string $slug

0 commit comments

Comments
 (0)