Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4e95983

Browse files
committed
Fixing conflicts and merging.
2 parents e09981a + 16de743 commit 4e95983

27 files changed

Lines changed: 349 additions & 81 deletions

src/Illuminate/Container/Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ protected function getClosure($abstract, $concrete)
165165
* @param string $abstract
166166
* @param Closure|string|null $concrete
167167
* @param bool $shared
168-
* @return bool
168+
* @return void
169169
*/
170170
public function bindIf($abstract, $concrete = null, $shared = false)
171171
{

src/Illuminate/Database/Eloquent/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function find($id, $columns = array('*'))
9191
*/
9292
public function findMany($id, $columns = array('*'))
9393
{
94-
if (empty($id)) return new Collection;
94+
if (empty($id)) return $this->model->newCollection();
9595

9696
$this->query->whereIn($this->model->getKeyName(), $id);
9797

src/Illuminate/Database/Eloquent/Relations/MorphTo.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ class MorphTo extends BelongsTo {
2828
*/
2929
protected $dictionary = array();
3030

31+
/*
32+
* Indicates if soft-deleted model instances should be fetched.
33+
*
34+
* @var bool
35+
*/
36+
protected $withTrashed = false;
37+
3138
/**
3239
* Create a new belongs to relationship instance.
3340
*
@@ -150,6 +157,11 @@ protected function getResultsByType($type)
150157
{
151158
$instance = $this->createModelByType($type);
152159

160+
if ($this->withTrashed && $instance->newQuery()->getMacro('withTrashed') !== null)
161+
{
162+
$instance = $instance->withTrashed();
163+
}
164+
153165
$key = $instance->getKeyName();
154166

155167
return $instance->whereIn($key, $this->gatherKeysByType($type)->all())->get();
@@ -193,4 +205,16 @@ public function getDictionary()
193205
return $this->dictionary;
194206
}
195207

208+
/**
209+
* Fetch soft-deleted model instances with query
210+
*
211+
* @return MorphTo
212+
*/
213+
public function withTrashed()
214+
{
215+
$this->withTrashed = true;
216+
217+
return $this;
218+
}
219+
196220
}

src/Illuminate/Database/Grammar.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ public function wrap($value)
8383
*/
8484
protected function wrapValue($value)
8585
{
86-
return $value !== '*' ? sprintf($this->wrapper, $value) : $value;
86+
if ($value === '*') return $value;
87+
88+
return '"'.str_replace('"', '""', $value).'"';
8789
}
8890

8991
/**

src/Illuminate/Database/Query/Grammars/Grammar.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55

66
class Grammar extends BaseGrammar {
77

8-
/**
9-
* The keyword identifier wrapper format.
10-
*
11-
* @var string
12-
*/
13-
protected $wrapper = '"%s"';
14-
158
/**
169
* The components that make up a select clause.
1710
*

src/Illuminate/Database/Query/Grammars/MySqlGrammar.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@
44

55
class MySqlGrammar extends Grammar {
66

7-
/**
8-
* The keyword identifier wrapper format.
9-
*
10-
* @var string
11-
*/
12-
protected $wrapper = '`%s`';
13-
147
/**
158
* The components that make up a select clause.
169
*
@@ -99,4 +92,17 @@ public function compileUpdate(Builder $query, $values)
9992
return rtrim($sql);
10093
}
10194

95+
/**
96+
* Wrap a single string in keyword identifiers.
97+
*
98+
* @param string $value
99+
* @return string
100+
*/
101+
protected function wrapValue($value)
102+
{
103+
if ($value === '*') return $value;
104+
105+
return '`'.str_replace('`', '``', $value).'`';
106+
}
107+
102108
}

src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ class SqlServerGrammar extends Grammar {
1515
'&', '&=', '|', '|=', '^', '^=',
1616
);
1717

18-
/**
19-
* The keyword identifier wrapper format.
20-
*
21-
* @var string
22-
*/
23-
protected $wrapper = '[%s]';
24-
2518
/**
2619
* Compile a select query into SQL.
2720
*
@@ -217,4 +210,17 @@ public function getDateFormat()
217210
return 'Y-m-d H:i:s.000';
218211
}
219212

213+
/**
214+
* Wrap a single string in keyword identifiers.
215+
*
216+
* @param string $value
217+
* @return string
218+
*/
219+
protected function wrapValue($value)
220+
{
221+
if ($value === '*') return $value;
222+
223+
return '['.str_replace(']', ']]', $value).']';
224+
}
225+
220226
}

src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@
66

77
class MySqlGrammar extends Grammar {
88

9-
/**
10-
* The keyword identifier wrapper format.
11-
*
12-
* @var string
13-
*/
14-
protected $wrapper = '`%s`';
15-
169
/**
1710
* The possible column modifiers.
1811
*
@@ -574,4 +567,17 @@ protected function modifyAfter(Blueprint $blueprint, Fluent $column)
574567
}
575568
}
576569

570+
/**
571+
* Wrap a single string in keyword identifiers.
572+
*
573+
* @param string $value
574+
* @return string
575+
*/
576+
protected function wrapValue($value)
577+
{
578+
if ($value === '*') return $value;
579+
580+
return '`'.str_replace('`', '``', $value).'`';
581+
}
582+
577583
}

src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55

66
class PostgresGrammar extends Grammar {
77

8-
/**
9-
* The keyword identifier wrapper format.
10-
*
11-
* @var string
12-
*/
13-
protected $wrapper = '"%s"';
14-
158
/**
169
* The possible column modifiers.
1710
*

src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@
66

77
class SQLiteGrammar extends Grammar {
88

9-
/**
10-
* The keyword identifier wrapper format.
11-
*
12-
* @var string
13-
*/
14-
protected $wrapper = '"%s"';
15-
169
/**
1710
* The possible column modifiers.
1811
*

0 commit comments

Comments
 (0)