<!-- Stored in resources/views/layouts/master.blade.php-->
<html>
<head>
<title>App Name - @yield('title')</title>
</head>
<body>
@section('sidebar')
This is the master sidebar.
@show
<div class="container">
@yield('content')
</div>
</body>
</html>
<!-- Stored in resoures/views/child.blade.php -->
@extends('layouts.master')
@section('title', 'Page Title')
@section('sidebar')
@parent
<p>This is appended to the master sidebar.</p>
@endsection
@section('content')
<p>This is my body content.</p>
@endsection
Route::get('blade', function () {
return view('child');
});
Route::get('greeting', function () {
return view('welcome', ['name' => 'Duicode']);
})
Hello, {{ $name }}
The current UNIX timestamp is {{ time() }}
Hello, @{{ name }}
{{ isset($name) ? $name : 'Default' }}
{{ $name or 'Default' }}
Hello, {!! $name !!}
@if (count($records) === 1) I have one record! @elseif (count($records) > 1) I have multiple records! @else I don't have any records! @endif
@unless (Auth::check()) You are not signed in. @endunless
<title>
@hasSection('title')
@yield('title') - App Name
@else
App Name
@endif
</title>
@for ($i = 0; $i < 10; $i++)
The current value is {{ $i }}
@endfor
@foreach ($users as $user)
<p>This is user {{ $user->id }}</p>
@endforeach
@forelse ($users as $user)
<li>{{ $user->name }}</li>
@empty
<p>No users</p>
@endforelse
@while (true)
<p>I'm looping forever.</p>
@endwhile
@foreach ($users as $user)
@if($user->type == 1)
@continue
@endif
<li>{{ $user->name }}</li>
@if($user->number == 5)
@break
@endif
@endforeach
@foreach ($users as $user)
@continue($user->type == 1)
<li>{{ $user->name }}</li>
@break($user->number == 5)
@endforeach
<div>
@include('shared.errors')
<form>
<!-- Form Contents -->
</form>
</div>
@include('view.name', ['some' => 'data'])
@each('view.name', $jobs, 'job')
@each('view.name', $jobs, 'job', 'view.empty')
{{-- This comment will not be present in the rendered HTML --}}
@push('scripts')
<script src="/example.js"></script>
@endpush
<head>
<!-- Head Contents -->
@stack('scripts')
</head>
@inject('metrics', 'App\Services\MetricsService')
<div>
Monthly Revenue: {{ $metrice->monthlyRevenue() }}
</div>
<?php
namespace App\Providers;
use Blade;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider{
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot(){
Blade::directive('datetime', function ($expression) {
return "<?php echo with{$express}->format('m/d/Y H:i'); ?>";
});
}
/**
* Register bindings in the container
*
* @return void
*/
public function register() {
//
}
}
<?php echo with($var)->format('m/d/Y H:i'); ?>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-3 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2026 源码网商城 (www.yuanmawang.com) 版权所有