Первоначальная проблема, когда я создавал приложение с помощью quickadminpanel.com (панель администратора Laravel), я создал два меню, а именно меню документа и меню компетенций. Потом скачиваю & установить на экран как обычно. Через несколько мгновений я хочу добавить новое меню, а именно меню обучения. Поэтому я добавил меню обучения в ручном кодировании. Но когда он закончится, меню обучения будет недоступно. И Symfony \ Component \ HttpKernel \ Exception \ HttpException error appears No message
Как с этой ошибкой из Laravel 5.6. Я создаю новый метод, но я не могу получить доступ к этому меню из браузера. Пожалуйста, помогите мне исправить эту ошибку. Для деталей нажмите на эти изображения.
Ошибка изображения HttpException
Ошибка изображения 401 не авторизована
Отмена возврата изображения (401)
DaftarTrainingsController.php
namespace App\Http\Controllers\Admin;
use App\DaftarTraining;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Gate;
use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\StoreDaftarTrainingsRequest;
use App\Http\Requests\Admin\UpdateDaftarTrainingsRequest;
use Yajra\DataTables\DataTables;
class DaftarTrainingsController extends Controller
{
/**
* Display a listing of DaftarTraining.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
if (! Gate::allows('daftar_training_access')) {
return abort(401);
}
if (request()->ajax()) {
$query = DaftarTraining::query();
$query->with("kategori_training");
$template = 'actionsTemplate';
if(request('show_deleted') == 1) {
if (! Gate::allows('daftar_training_delete')) {
return abort(401);
}
$query->onlyTrashed();
$template = 'restoreTemplate';
}
$query->select([
'daftar_trainings.id',
'daftar_trainings.judul_acara_training',
'daftar_trainings.kategori_training_id',
'daftar_trainings.pemateri',
'daftar_trainings.tanggal_mulai_pelaksanaan',
'daftar_trainings.tanggal_akhir_pelaksanaan',
'daftar_trainings.jumla_peserta',
'daftar_trainings.alamat_training',
]);
$table = Datatables::of($query);
$table->setRowAttr([
'data-entry-id' => '{{$id}}',
]);
$table->addColumn('massDelete', ' ');
$table->addColumn('actions', ' ');
$table->editColumn('actions', function ($row) use ($template) {
$gateKey = 'daftar_training_';
$routeKey = 'admin.daftar_trainings';
return view($template, compact('row', 'gateKey', 'routeKey'));
});
$table->editColumn('judul_acara_training', function ($row) {
return $row->judul_acara_training ? $row->judul_acara_training : '';
});
$table->editColumn('kategori_training.nama_training', function ($row) {
return $row->kategori_training ? $row->kategori_training->nama_training : '';
});
$table->editColumn('pemateri', function ($row) {
return $row->pemateri ? $row->pemateri : '';
});
$table->editColumn('tanggal_mulai_pelaksanaan', function ($row) {
return $row->tanggal_mulai_pelaksanaan ? $row->tanggal_mulai_pelaksanaan : '';
});
$table->editColumn('tanggal_akhir_pelaksanaan', function ($row) {
return $row->tanggal_akhir_pelaksanaan ? $row->tanggal_akhir_pelaksanaan : '';
});
$table->editColumn('jumla_peserta', function ($row) {
return $row->jumla_peserta ? $row->jumla_peserta : '';
});
$table->editColumn('alamat_training', function ($row) {
return $row->alamat_training ? $row->alamat_training : '';
});
$table->rawColumns(['actions','massDelete']);
return $table->make(true);
}
return view('admin.daftar_trainings.index');
}
/**
* Show the form for creating new DaftarTraining.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
if (! Gate::allows('daftar_training_create')) {
return abort(401);
}
$kategori_trainings = \App\KategoriTraining::get()->pluck('nama_training', 'id')->prepend(trans('quickadmin.qa_please_select'), '');
return view('admin.daftar_trainings.create', compact('kategori_trainings'));
}
/**
* Store a newly created DaftarTraining in storage.
*
* @param \App\Http\Requests\StoreDaftarTrainingsRequest $request
* @return \Illuminate\Http\Response
*/
public function store(StoreDaftarTrainingsRequest $request)
{
if (! Gate::allows('daftar_training_create')) {
return abort(401);
}
$daftar_training = DaftarTraining::create($request->all());
return redirect()->route('admin.daftar_trainings.index');
}
/**
* Show the form for editing DaftarTraining.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
if (! Gate::allows('daftar_training_edit')) {
return abort(401);
}
$kategori_trainings = \App\KategoriTraining::get()->pluck('nama_training', 'id')->prepend(trans('quickadmin.qa_please_select'), '');
$daftar_training = DaftarTraining::findOrFail($id);
return view('admin.daftar_trainings.edit', compact('daftar_training', 'kategori_trainings'));
}
/**
* Update DaftarTraining in storage.
*
* @param \App\Http\Requests\UpdateDaftarTrainingsRequest $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(UpdateDaftarTrainingsRequest $request, $id)
{
if (! Gate::allows('daftar_training_edit')) {
return abort(401);
}
$daftar_training = DaftarTraining::findOrFail($id);
$daftar_training->update($request->all());
return redirect()->route('admin.daftar_trainings.index');
}
/**
* Display DaftarTraining.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
if (! Gate::allows('daftar_training_view')) {
return abort(401);
}
$daftar_training = DaftarTraining::findOrFail($id);
return view('admin.daftar_trainings.show', compact('daftar_training'));
}
/**
* Remove DaftarTraining from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
if (! Gate::allows('daftar_training_delete')) {
return abort(401);
}
$daftar_training = DaftarTraining::findOrFail($id);
$daftar_training->delete();
return redirect()->route('admin.daftar_trainings.index');
}
/**
* Delete all selected DaftarTraining at once.
*
* @param Request $request
*/
public function massDestroy(Request $request)
{
if (! Gate::allows('daftar_training_delete')) {
return abort(401);
}
if ($request->input('ids')) {
$entries = DaftarTraining::whereIn('id', $request->input('ids'))->get();
foreach ($entries as $entry) {
$entry->delete();
}
}
}
/**
* Restore DaftarTraining from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function restore($id)
{
if (! Gate::allows('daftar_training_delete')) {
return abort(401);
}
$daftar_training = DaftarTraining::onlyTrashed()->findOrFail($id);
$daftar_training->restore();
return redirect()->route('admin.daftar_trainings.index');
}
/**
* Permanently delete DaftarTraining from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function perma_del($id)
{
if (! Gate::allows('daftar_training_delete')) {
return abort(401);
}
$daftar_training = DaftarTraining::onlyTrashed()->findOrFail($id);
$daftar_training->forceDelete();
return redirect()->route('admin.daftar_trainings.index');
}
}
web.php
<?php
Route::get('/', function () { return redirect('/admin/home'); });
// Authentication Routes...
$this->get('login', 'Auth\LoginController@showLoginForm')->name('login');
$this->post('login', 'Auth\LoginController@login')->name('auth.login');
$this->post('logout', 'Auth\LoginController@logout')->name('auth.logout');
// Change Password Routes...
$this->get('change_password', 'Auth\ChangePasswordController@showChangePasswordForm')->name('auth.change_password');
$this->patch('change_password', 'Auth\ChangePasswordController@changePassword')->name('auth.change_password');
// Password Reset Routes...
$this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('auth.password.reset');
$this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('auth.password.reset');
$this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
$this->post('password/reset', 'Auth\ResetPasswordController@reset')->name('auth.password.reset');
Route::group(['middleware' => ['auth'], 'prefix' => 'admin', 'as' => 'admin.'], function () {
Route::get('/home', 'HomeController@index');
Route::resource('daftar_dokumens', 'Admin\DaftarDokumensController');
Route::post('daftar_dokumens_mass_destroy', ['uses' => 'Admin\DaftarDokumensController@massDestroy', 'as' => 'daftar_dokumens.mass_destroy']);
Route::post('daftar_dokumens_restore/{id}', ['uses' => 'Admin\DaftarDokumensController@restore', 'as' => 'daftar_dokumens.restore']);
Route::delete('daftar_dokumens_perma_del/{id}', ['uses' => 'Admin\DaftarDokumensController@perma_del', 'as' => 'daftar_dokumens.perma_del']);
Route::resource('kategori_dokumens', 'Admin\KategoriDokumensController');
Route::post('kategori_dokumens_mass_destroy', ['uses' => 'Admin\KategoriDokumensController@massDestroy', 'as' => 'kategori_dokumens.mass_destroy']);
Route::post('kategori_dokumens_restore/{id}', ['uses' => 'Admin\KategoriDokumensController@restore', 'as' => 'kategori_dokumens.restore']);
Route::delete('kategori_dokumens_perma_del/{id}', ['uses' => 'Admin\KategoriDokumensController@perma_del', 'as' => 'kategori_dokumens.perma_del']);
Route::resource('roles', 'Admin\RolesController');
Route::post('roles_mass_destroy', ['uses' => 'Admin\RolesController@massDestroy', 'as' => 'roles.mass_destroy']);
Route::resource('users', 'Admin\UsersController');
Route::post('users_mass_destroy', ['uses' => 'Admin\UsersController@massDestroy', 'as' => 'users.mass_destroy']);
Route::resource('basis_kompetensis', 'Admin\BasisKompetensisController');
Route::post('basis_kompetensis_mass_destroy', ['uses' => 'Admin\BasisKompetensisController@massDestroy', 'as' => 'basis_kompetensis.mass_destroy']);
Route::post('basis_kompetensis_restore/{id}', ['uses' => 'Admin\BasisKompetensisController@restore', 'as' => 'basis_kompetensis.restore']);
Route::delete('basis_kompetensis_perma_del/{id}', ['uses' => 'Admin\BasisKompetensisController@perma_del', 'as' => 'basis_kompetensis.perma_del']);
Route::resource('kategori_trainings', 'Admin\KategoriTrainingsController');
Route::post('kategori_trainings_mass_destroy', ['uses' => 'Admin\KategoriTrainingsController@massDestroy', 'as' => 'kategori_trainings.mass_destroy']);
Route::post('kategori_trainings_restore/{id}', ['uses' => 'Admin\KategoriTrainingsController@restore', 'as' => 'kategori_trainings.restore']);
Route::delete('kategori_trainings_perma_del/{id}', ['uses' => 'Admin\KategoriTrainingsController@perma_del', 'as' => 'kategori_trainings.perma_del']);
Route::resource('daftar_trainings', 'Admin\DaftarTrainingsController');
Route::post('daftar_trainings_mass_destroy', ['uses' => 'Admin\DaftarTrainingsController@massDestroy', 'as' => 'daftar_trainings.mass_destroy']);
Route::post('daftar_trainings_restore/{id}', ['uses' => 'Admin\DaftarTrainingsController@restore', 'as' => 'daftar_trainings.restore']);
Route::delete('daftar_trainings_perma_del/{id}', ['uses' => 'Admin\DaftarTrainingsController@perma_del', 'as' => 'daftar_trainings.perma_del']);
});
Задача ещё не решена.
Других решений пока нет …