protected $webYourNamespace = 'App\Http\Controllers\Web';
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
//
$this->mapYourCustomRoutes();
}
protected function mapYourCustomRoutes()
{
Route::middleware('web')
->namespace($this->webYourNamespace)
->group(base_path('routes/custom.route.php'));
}
<!-- Stored in resources/views/layouts/app.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 resources/views/child.blade.php -->
@extends('layouts.app')
@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('/{project}', 'ProjectController@index')->middleware('permissions:project|admin')->name('project.index');
//client model
public function flights()
{
return $this->belongsToMany('App\Flight');
}
//flight model
public function clients()
{
return $this->belongsToMany('App\Client');
}
//controller
$client = App\Client::find(1);
foreach ($client->flights as $value) {
$value->ticket_name;
}
echo parse_url("http://foo?bar#fizzbuzz",PHP_URL_FRAGMENT);
<script>alert(window.location.hash);</script>
<script>$('#LocationHash').val(document.location.hash.replace('#',''));</script>
<input type="hidden" id="LocationHash" name="LocationHash" value="">
Route::domain('{account}.myapp.com')->group(function () {
Route::get('user/{id}', function ($account, $id) {
//
});
});
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:60,1',
'bindings',
],
];
Route::post('/invoice/pdf', 'InvoiceController@getInvoice')->name('getInvoice');
<form role="form" action="{{ route('getInvoice') }}" method="post">
{{ csrf_field() }}
<input type="hidden" name="invoice_id" value="{{ $item->DocID }}">
<button type="submit" class="btn btn-link">скачать</button>
</form>
/**
* @param Request $request
*
* @return $this
*/
public function getInvoice(Request $request)
{
//валидируем
//подключаем пдф
$pdf = app('dompdf.wrapper');
//формируем пдф вью
$pdf->loadView('docs.invoice');
//возвращаем на скачивание
return $pdf->download('invoice.pdf');
}