Laravel-Backpack / CRUD

Build custom admin panels. Fast!
https://backpackforlaravel.com
MIT License
3.11k stars 890 forks source link

[Bug] One crud of many not properly working create/edit/preview pages. #5494

Closed slowas closed 5 months ago

slowas commented 5 months ago

Bug report

What I did

Project is working and tryed to clear cache and in some error at some time i run backpack:build and this error shows.

What I expected to happen

Show edit page / and create pages. List table is working. Code is all good on localhost is working. Same code base.

What happened

Edit/create page image List page

image

Other pages is working except create/edit/preview Other cruds fully working. Just post crud.

<?php

namespace App\Http\Controllers\Admin;

use App\Http\Requests\PostRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;

/**
 * Class PostCrudController
 * @package App\Http\Controllers\Admin
 * @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
 */
class PostCrudController extends CrudController
{
    use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
    use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
    use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
    use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
    use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;

    /**
     * Configure the CrudPanel object. Apply settings to all operations.
     *
     * @return void
     */
    public function setup()
    {
        CRUD::setModel(\App\Models\Post::class);
        CRUD::setRoute(config('backpack.base.route_prefix') . '/post');
        CRUD::setEntityNameStrings('post', 'posts');
    }

    /**
     * Define what happens when the List operation is loaded.
     *
     * @see  https://backpackforlaravel.com/docs/crud-operation-list-entries
     * @return void
     */
    protected function setupListOperation()
    {
        CRUD::addColumns([
            [
                'label' => '#',
                'name' => 'id'
            ],
            [
                'label' => 'Title',
                'name' => 'title'
            ],
            [
                'label' => 'Image',
                'name' => 'image',
                'type' => 'image',
            ],
        ]);
    }

    /**
     * Define what happens when the Create operation is loaded.
     *
     * @see https://backpackforlaravel.com/docs/crud-operation-create
     * @return void
     */
    protected function setupCreateOperation()
    {
        CRUD::setValidation(PostRequest::class);

        CRUD::addFields([
            [
                'label' => 'Title',
                'name' => 'title',
                'type' => 'text',
            ],
            [
                'label' => 'Slug',
                'name' => 'slug',
                'type' => 'slug',
                'target'  => 'title',
            ],
            [
                'label' => 'Content',
                'name' => 'content',
                'type' => 'summernote',
            ],
            [
                'label' => 'Image',
                'name' => 'image',
                'type' => 'upload',
                'upload' => true,
                'disk' => 'public',
            ],
            [
                'label' => 'Neta title',
                'name' => 'meta_title'
            ],
            [
                'label' => 'Meta aprašymas',
                'name' => 'meta_description'
            ],
            [
                'label' => 'Meta raktažodžiai',
                'name' => 'meta_keywords'
            ],
        ]);

        /**
         * Fields can be defined using the fluent syntax:
         * - CRUD::field('price')->type('number');
         */
    }

    /**
     * Define what happens when the Update operation is loaded.
     *
     * @see https://backpackforlaravel.com/docs/crud-operation-update
     * @return void
     */
    protected function setupUpdateOperation()
    {
        $this->setupCreateOperation();
    }
}

What I've already tried to fix it

Nothing is working..

Is it a bug in the latest version of Backpack?

YES

Backpack, Laravel, PHP, DB version

backpack/basset: 1.3.0 backpack/crud: 6.7.6 backpack/filemanager: 3.0.7 backpack/generators: v4.0.4 backpack/logmanager: v5.0.1 backpack/pro: 2.1.11 backpack/theme-coreuiv4: 1.1.1 backpack/theme-tabler: 1.2.8 root@sjxi:/var/www/sosvan.com#

welcome[bot] commented 5 months ago

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication channels:

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

-- Justin Case The Backpack Robot

jcastroa87 commented 5 months ago

Hello @slowas

Can you please share your Model and PostRequest with me?

And there are some error details on debug.log or server-side error log?

Thanks.

slowas commented 5 months ago

Hey, i fixed problem by clearing published backpack views and published again. weird error..