$arr = [['name' => 412], ['name' => 3144], ['name' => 632]];
$new_arr = array_combine(range(1, count($arr)), array_values($arr));
var_dump($new_arr);
/*
array(3) {
[1]=>
array(1) {
["name"]=>
int(412)
}
[2]=>
array(1) {
["name"]=>
int(3144)
}
[3]=>
array(1) {
["name"]=>
int(632)
}
}
*/
<div id="{{ $modal_id }}" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog {{ $modal_dialog_styles}} modal-dialog-centered" role="document">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal" aria-label="Закрыть"></button>
<div class="modal-header">
<h3 class="modal-title text-center">{{ $modal_title }}</h3>
</div>
<div class="modal-body">
<div class="row justify-content-center">
<div class="col-12 col-lg-10">
{{ $slot }}
</div>
</div>
</div>
<div class="modal-footer row justify-content-center">
{{ $modal_footer }}
</div>
</div>
</div>
</div>
@component('modal', ['modal_id' => '1', 'modal_title' => 'Модальное окно'])
Содержание окна
@endcomponent
class AlbumTest extends TestCase
{
use DatabaseMigrations;
public function test()
{
$album = factory('Album')->create();
$songs = new Collection([
factory('Song')->make(['duration' => 291]),
factory('Song')->make(['duration' => 123]),
factory('Song')->make(['duration' => 100]),
]);
$album->songs()->saveMany($songs);
}
}
return [
'news_per_page' => 10
]
config('cms.news_per_page');
class Recipe extends Model
{
public function tag_links()
{
return $this->hasMany('Recipe_Tag', 'recipe_id');
}
}
class Recipe_Tag extends Model
{
public function tag()
{
return $this->hasOne('Tag', 'tag_id');
}
}
class Tag extends Model
{
}
$receipes = Recipe::with('tag_links')->get();
foreach ($receipes as $receipe)
{
echo '<h1>'.$receipe->title.'</h1>';
echo 'Категории: ';
foreach ($receipe->tag_links as $tag_link)
{
echo $tag_link->tag->name;
}
}
<?php
namespace App\Helpers;
class Titles
{
private $title = null;
private $h1 = null;
public function setTitle($title) {
$this->title = $title;
}
public function getTitle() {
return $this->title;
}
public function setH1($h1) {
$this->h1 = $h1;
}
public function getH1() {
return $this->h1;
}
}
...
public function boot()
{
...
$this->app->singleton('Titles', function($app) {
return new \App\Helpers\Titles();
});
...
}
...
app()['Titles']->setTitle('Очередной интернет-магазин');
app()['Titles']->getTitle();
<?php
namespace App\Facades;
use Illuminate\Support\Facades\Facade;
class Titles extends Facade
{
protected static function getFacadeAccessor() {
return 'Titles';
}
}
...
'aliases' => [
...
'Titles' => \App\Facades\Titles::class,
...
],
...
<?php
namespace App\Http\Controllers;
use Titles;
class UserController extends Controller
{
public function signup() {
Titles::setTitle('Добро пожаловать!');
return view('user.signup');
}
}
Assets::add(['another/file.js', 'one/more.css']);
laravel new нужный_путь
composer create-project laravel/laravel нужный_путь
'age' => (integer) (array_get($user, 'ageRange')['min'] + array_get($user, 'ageRange')['max']) / 2,