Ошибка Laravel Упс, похоже, что-то пошло не так. 2/2 Исключение ошибки в path/storage/framework/views/44812f12bcefe0281da2f29a7f94d872 строка 40

#laravel #laravel-5

#laravel #laravel-5

Вопрос:

Я получил сообщение об ошибке следующим образом, и я этого не понимаю. Это проблема сеанса.

2/2 Упс, похоже, что-то пошло не так. Исключение ошибки в /path-to-app/storage/framework/views/44812f12bcefe0281da2f29a7f94d872 строка 40: попытка получить свойство не-объекта (просмотр: /path-to-app/resources/views/backend/base/clients/companies/peoples/index_all.blade.php )

1/2 Исключение ошибки в 44812f12bcefe0281da2f29a7f94d872 строка 40: попытка получить свойство не-объекта

это представление index_all.blade.php:

 @extends('backend/base/layouts/default')

@section('title')
    Clients Management
@stop
@section('header')
<link href="{{ asset('assets/plugins/forms/togglebutton/toggle-buttons.css') }}" type="text/css" rel="stylesheet" />
@stop
@section('content')
{{ Company::filterForm() }}</div>
    <div class="col-lg-12">
        <div class="page-header">
            <h3>All People
            <a href="{{ URL::route('clients.companies.peoples.create') }}" class="pull-right icon tip" title="Associate a People"><span class="icon16 iconic-icon-plus"></span></a>
            </h3>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <table cellpadding="0" cellspacing="0" border="0" class="dynamicTable display table dataTable">
                    <thead>
                        <tr>
                            <th>Full name</th>
                            <th>e-mail</th>
                            <th>Phone Number</th>
                            <th>Company</th>
                            <th>Country</th>
                            <th>City</th>
                            <th>Industry</th>
                            <th>Products</th>
                            <th>Status</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                    @foreach($companies as $company)
                        @foreach($company->peoples as $people)
                            <tr>
                                <td><a href="{{ URL::route('clients.companies.peoples.show', array($company->id, $people->id)) }}">{{ $people->fullName }}</a></td>
                                <td><a href="mailto:{{ $people->email1 }}">{{ $people->email1 }}</a></td>
                                <td><a href="skype:{{ $people->landline }}">{{ $people->landline }}</a></td>
                                <td><a href="{{ URL::route('clients.companies.show', $company->id) }}">{{ $company->name }}</a></td>
                                <td>{{ $company->country->name }}</td>
                                <td>{{ $company->city }}</td>
                                <td>
                                    @foreach($company->industries as $industry)
                                        {{ $industry->title }}
                                    @endforeach
                                </td>
                                <td>{{ $company->tags }}</td>
                                <td>
                                    <div class="left marginR10">
                                        <div class="iToggle-button"><input type="checkbox" class="nostyle"
                                            @if($people->User)
                                                @if( !$people->User->isActivated() )
                                                     onchange="window.location.replace('/admin/users/{{encrypt($people->User->id)}}/activate');" 
                                                @else
                                                    checked="checked" 
                                                    @if(!$people->User->isCurrent())
                                                    onchange="window.location.replace('/admin/users/{{encrypt($people->User->id)}}/deactivate');" 
                                                    @else
                                                        disabled
                                                    @endif
                                                @endif
                                            @else
                                                disabled 
                                            @endif
                                            >
                                        </div>
                                    </div>
                                </td>
                                <td>
                                    <a title="Update" class="tip" href="{{ URL::route('clients.companies.peoples.update', array($company->id, $people->id)) }}"><span class="icon16 typ-icon-pencil"></span></a> 
                                    @if(Sentry::getUser()->hasAccess('contacts'))
                                        <a title="Delete" href="{{ URL::route('clients.companies.peoples.delete', array($company->id, $people->id)) }}"><span class="icon16 typ-icon-cross"></span></a>
                                    @endif
                                </td>           
                            </tr>
                        @endforeach
                    @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
@stop

@section('footer_script')
<script type="text/javascript" src="{{ asset('assets/plugins/forms/togglebutton/jquery.toggle.buttons.js') }}"></script>
@stop

@section('footer')
<script type="text/javascript">
    $('.iToggle-button').toggleButtons({
        width: 70,
        label: {
            enabled: "<span class='icon16 icomoon-icon-checkmark white'></span>",
            disabled: "<span class='icon16 icomoon-icon-close white marginL10'></span>"
        }
    });

    function toggleButtons () {
         $('.iToggle-button').toggleButtons({
            width: 70,
            label: {
                enabled: "<span class='icon16 icomoon-icon-checkmark white'></span>",
                disabled: "<span class='icon16 icomoon-icon-close white marginL10'></span>"
            }
        });
    }
</script>
@stop
  

и это индекс контроллера

 namespace ControllersAdminClients;

use BackendController;
use People;
use Redirect;
use Company;
use Config;
use Input;
use Activity;
use Todo;
use Sentry;
use Breadcrumbs;
use Email;
use EMailTemplate;
use Token;
use Lang;
use URL;
use Response;
use Validator;
use Session;

class PeoplesController extends BackendController {

    public function __construct(){
        parent::__construct();

        if(Sentry::check() amp;amp; !(Sentry::getUser()->hasAccess('contacts.peoples') || Sentry::getUser()->hasAccess('contacts'))){
            throw new PermissionDeniedException();
        }
    }

    /**
     * Display a listing of the resource.
     *
     * @return Response
     */
    public function getIndex($id = null)
    {
        if($id == null)
        {
            $companies = Company::hasPermission(array('c', 'r', 'u', 'd'), Sentry::getUser()->id, false)->with('peoples', 'country', 'industries')->filter()->get();

            Breadcrumbs::register('clients.peoples', function($b){
                $b->parent('cp');

                $b->push('Clients');
                $b->push('Companies', route('clients.companies'));
                $b->push('Peoples');
            });
            self::$breadcrumbs = Breadcrumbs::render('clients.peoples');

            return self::view('clients/companies/peoples/index_all')
                    ->with('companies', $companies);
        }
        else
        {
            $company = Company::hasPermission(array('c', 'r', 'u', 'd'), Sentry::getUser()->id, false)->with('peoples', 'country', 'industries')->filter()->find($id);

            Breadcrumbs::register('clients.peoples', function($b, $company){
                $b->parent('cp'); // @ we can actuall inherit this class from CompaniesController to make it easier and more structural.

                $b->push('Clients');
                $b->push('Companies', route('clients.companies'));
                $b->push($company->name, route('clients.companies.show', $company->id));
                $b->push('Peoples');
            });
            self::$breadcrumbs = Breadcrumbs::render('clients.peoples', $company);

            return self::view('clients/companies/peoples/index')
                    ->with('company', $company);
        }
    }
  

Комментарии:

1. ошибка в вашем index_all.blade.php страница, на которой вы пытаетесь получить доступ к нулевому значению объекта, пожалуйста, добавьте свой контроллер и просмотрите код для понимания

2. Попробуйте очистить кеш php artisan cache:clear , а php artisan view:clear затем проверьте свой код в строке 40

3. @mateonunez php artisan view: очистить не работает на моем laravel 5.0: [InvalidArgumentException] В пространстве имен «view» нет команд, определенных.

4. @Shahrukh отредактировал первоначальный вопрос