За последние 24 часа нас посетили 18804 программиста и 1608 роботов. Сейчас ищут 655 программистов ...

Как исправить 1/1 ErrorException in AboutController.php line 24: Unde?

Тема в разделе "Laravel", создана пользователем boss1, 21 фев 2021.

  1. boss1

    boss1 Новичок

    С нами с:
    18 фев 2021
    Сообщения:
    70
    Симпатии:
    0
    Код (Text):
    1. <?php
    2.  
    3. namespace App\Http\Controllers\Admin;
    4.  
    5.  
    6. use Illuminate\Http\Request;
    7.  
    8. use App\Http\Requests;
    9. use App\Http\Controllers\Controller;
    10.  
    11. use DB;
    12.  
    13. use Illuminate\Http\Response;
    14. use Illuminate\Http\RedirectResponse;
    15.  
    16. class AboutController extends Controller
    17. {
    18.   //
    19.   public function show() {
    20.  
    21.   if(view()->exists('default.about')) {
    22.  
    23.   $page = DB::select("SELECT `name`,`text` FROm `pages` WHERE `alias` = :alias",['alias'=>'about']);
    24.   return view('default.about')->withPage($page[0])->withTitle('About our company');
    25.  
    26.   }
    27.   abort(404);
    28.   }
    29.  
    30. }
    Whoops, looks like something went wrong.
    1/1 ErrorException in AboutController.php line 24: Undefined offset: 0

    in AboutController.php line 24
    at HandleExceptions->handleError('8', 'Undefined offset: 0', 'A:\on\OpenServer\domains\localhost\app\Http\Controllers\Admin\AboutController.php', '24', array('page' => array())) in AboutController.php line 24
    at AboutController->show()
    at call_user_func_array(array(object(AboutController), 'show'), array()) in Controller.php line 55
    at Controller->callAction('show', array()) in ControllerDispatcher.php line 44
    at ControllerDispatcher->dispatch(object(Route), object(AboutController), 'show') in Route.php line 189
    at Route->runController() in Route.php line 144
    at Route->run(object(Request)) in Router.php line 653
    at Router->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 53
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Mymiddleware.php line 29
    at Mymiddleware->handle(object(Request), object(Closure)) in Pipeline.php line 137
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in SubstituteBindings.php line 41
    at SubstituteBindings->handle(object(Request), object(Closure)) in Pipeline.php line 137
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 65
    at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 137
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
    at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 137
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
    at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 137
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
    at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 137
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
    at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 137
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
    at Pipeline->then(object(Closure)) in Router.php line 655
    at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 629
    at Router->dispatchToRoute(object(Request)) in Router.php line 607
    at Router->dispatch(object(Request)) in Kernel.php line 268
    at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 53
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
    at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 137
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
    at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
    at Pipeline->then(object(Closure)) in Kernel.php line 150
    at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 117
    at Kernel->handle(object(Request)) in index.php line 5
     
  2. boss1

    boss1 Новичок

    С нами с:
    18 фев 2021
    Сообщения:
    70
    Симпатии:
    0
    ошибку исправил. В базу сидер данные не записал
     
  3. ADSoft

    ADSoft Старожил

    С нами с:
    12 мар 2007
    Сообщения:
    3.854
    Симпатии:
    748
    Адрес:
    Татарстан
    Может попробуешь сначала искать решение проблемы? Переводить там на русский, чуток думать - и если ничего не получается, только тогда писать с просьбой о помощи?

    А то такое ощущение, что сначала постишь ошибку сюда а только потом начинаешь думать....

    И да, весь трейс ошибок из 100500 строк не надо постить, толку в этом нет достаточно просто текста ошибки
     
  4. mkramer

    mkramer Суперстар
    Команда форума Модератор

    С нами с:
    20 июн 2012
    Сообщения:
    8.579
    Симпатии:
    1.760
    @boss1 Не надо постить каждую ошибку. Есть отладчик, есть голова. Пользуйся. Иначе будет опять бан. Тебе не надоело?
     
  5. artoodetoo

    artoodetoo Суперстар
    Команда форума Модератор

    С нами с:
    11 июн 2010
    Сообщения:
    11.105
    Симпатии:
    1.243
    Адрес:
    там-сям
    Карлсончик убунта дорогой, ты вернулся!