This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
a.id | |
b.name, | |
s.name, | |
s.address, | |
max(ap.price) as newest_price, | |
wm.quantity | |
#— …. | |
FROM article a | |
JOIN brand b on a.brand_id = b.id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
a.id, | |
(SELECT name FROM brand WHERE id = a.brand_id) as name, | |
(SELECT group_concat(name) FROM supplier WHERE s.article_id = a.id) as supplier_names, | |
(SELECT max(price) FROM article_price WHERE article_id = a.id) as max_price | |
FROM article a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": [{ | |
"variable_1": 100001, | |
"variable_2": "Variable name", | |
"variable_3": "Variable name 2", | |
"variable_4": "2017–01–01", | |
"variable_5": [ | |
"value 1", | |
"value 2" | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": [{ | |
"a": 100001, | |
"b": "Variable name", | |
"c": "Variable name 2", | |
"d": "2017–01–01", | |
"e": [ | |
"value 1", | |
"value 2" | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Support\Facades\Config; | |
use Illuminate\Support\Facades\DB; | |
/** | |
* @author Marcel Domke <marcel.domke@aboutyou.de> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// append the composer only to one profile: ~/resources/views/profile | |
View::composer('profile', ...); | |
// to serveral: ~/resources/views/profile, ~/resources/views/profile_edit and ~/resources/views/profile_settings | |
View::composer(['profile', 'profile_edit', 'profile_settings'], ...); | |
// wildcard folders: all files in ~/resources/views/pages/* | |
View::composer(['*pages.*'], ...); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
View::composer('profile', function ($view) { | |
$view->with('user', ['...']); | |
}); | |
// OR | |
View::composer('profile', 'App\Http\ViewComposers\ProfileComposer'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use Illuminate\Support\Facades\View; | |
use Illuminate\Support\ServiceProvider; | |
class ViewComposerServiceProvider extends ServiceProvider | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ViewComposerTest extends TestCase | |
{ | |
/** | |
* @return void | |
*/ | |
public function testDetailHasNavigationItems() | |
{ | |
$this->get('/detail')->assertViewHas('navigation'); |
OlderNewer