Получается, что нужно дублировать код?
php artisan make:controller SomeController --resource
php artisan make:controller SomeController
<form action="/update" method="POST" accept-charset="UTF-8">
...
<button type="button" class="btn btn-success"><a href="/" class="menu">Обновить</a></button>
На это: <button type="submit" class="btn btn-success">Обновить</button>
public function update()
{
foreach (request()->multipleselect1 as $value)
echo "{$value}<br>";
foreach (request()->multipleselect2 as $value)
echo "{$value}<br>";
foreach (request()->multipleselect3 as $value)
echo "{$value}<br>";
foreach (request()->multipleselect4 as $value)
echo "{$value}<br>";
}
public function show($slug)
{
$blog = Blog::where('slug', $slug)->firstOrFail();
$category = Category::find($blog->category_id);
return view('blog.show', compact('blog'));
}
Route::get('blog/{slug}', 'BlogController@show')->name('blog.show');
@foreach ($blogs as $blog)
<a href="{{ route('blog.show', $blog->slug) }}">{{ $blog->title }}</a>
@endforeach
$cookie = \Cookie::forget('myCookie');
return response('view')->withCookie($cookie);
// Routes
Route::group(['prefix' => LaravelLocalization::setLocale()], function() {
Route::get('/', 'IndexController@index');
Route::get('news/{id}', 'IndexController@showNews')->name('show.news');
Route::get('page/{slug}', 'IndexController@showPage')->name('show.page');
});
// Views
<a href="{{ app()->getLocale() . $item->url }}">{{ $item->title }}</a>
А как в данном случае будет выборках разноязычных страниц и новостей ? У меня 3 таблицы с разными новостями ( на разных языках получается )
$table_name = 'pages_' . config('app.locale');
$pages = \DB::table($table_name)->get();
public function __construct()
{
// Set DSN
$dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->dbname;
// Set options
$options = array(
PDO::ATTR_PERSISTENT => true,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
);
// Create a new PDO instanace
try{
$this->dbh = new PDO($dsn, $this->user, $this->pass, $options);
}
// Catch any errors
catch(PDOException $e){
$this->error = $e->getMessage();
}
} // <-- Уберите эту скобку!
}