Git Product home page Git Product logo

Comments (7)

de-raaf-media avatar de-raaf-media commented on August 22, 2024 1

Thanks! I'll look into it. In the meantime I switched to your default crud package. Works very well in my current project.

from pagemanager.

tabacitu avatar tabacitu commented on August 22, 2024

Do you have "extras" in your $fillable property, on the model?

PS. For development questions (non-bugs), it's recommended that you post on Stack Overflow (using the backpack-for-laravel tag) or Gitter, after you're sure you can't solve the problem yourself and there isn't an answer to that already. There are a lot more people on Gitter and StackOverflow. Plus:

  • on StackOverflow people are rewarded with points for helping you out;
  • on StackOverflow your conversation will be better indexed by search engines;
  • for super-urgent issues, nothing beats a chatroom, like Gitter; if anyone's online, of course;
  • we can keep the Github Issues only for bugs that affect everyone, so we can crush them faster;

If you want to help people out with development question, that would be a HUGE help for the project. You can answer people:

Answering questions improves communication skills, makes you better understand the inner workings and improves your self-esteem. Just sayin' :-)

from pagemanager.

reeslo avatar reeslo commented on August 22, 2024

Sorry for poor informations :'( But only the extras field (default) are saved not the field I've added in PageTemplates trait

from pagemanager.

tabacitu avatar tabacitu commented on August 22, 2024

You should also add those to the $fillable array if you want them saved.

from pagemanager.

de-raaf-media avatar de-raaf-media commented on August 22, 2024

So far I like Backpack a lot! Nice work.

I tried this as well by extending Backpack\PageManager\app\Models\Page and adding my own fillable properties but that does not seem to work. Is there any way of adding to the fillable property without adding it to the model in the vendor directory?

from pagemanager.

tabacitu avatar tabacitu commented on August 22, 2024

Hi @de-raaf-media ,

For changing the Page model you should create the following files, that extend the ones in vendor:

  • app/Models/Page.php
  • app/Http/Controllers/Admin/PageCrudController.php - make this one use your model above

Your PageCrudController should look something like this:

<?php namespace App\Http\Controllers\Admin;

use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\PageManager\app\Http\Controllers\Admin\PageCrudController as OriginalPageCrudController;
use App\PageTemplates;

// VALIDATION: change the requests to match your own file names if you need form validation
use Backpack\PageManager\app\Http\Requests\PageRequest as StoreRequest;
use Backpack\PageManager\app\Http\Requests\PageRequest as UpdateRequest;

class PageCrudController extends OriginalPageCrudController {

    public function __construct($template_name = false)
    {
        /*
        |--------------------------------------------------------------------------
        | BASIC CRUD INFORMATION
        |--------------------------------------------------------------------------
        */
        $this->crud->setModel("App\Models\Page");
        $this->crud->setRoute(config('backpack.base.route_prefix').'/page');
        $this->crud->setEntityNameStrings('page', 'pages');

        /*
        |--------------------------------------------------------------------------
        | COLUMNS
        |--------------------------------------------------------------------------
        */

        $this->crud->addColumn('name');
        $this->crud->addColumn([
                                'name' => 'template',
                                'type' => 'model_function',
                                'function_name' => 'getTemplateName',
                                ]);
        $this->crud->addColumn('slug');

        /*
        |--------------------------------------------------------------------------
        | FIELDS
        |--------------------------------------------------------------------------
        */

        // In PageManager,
        // - default fields, that all templates are using, are set using $this->addDefaultPageFields();
        // - template-specific fields are set per-template, in the PageTemplates trait;


        /*
        |--------------------------------------------------------------------------
        | BUTTONS
        |--------------------------------------------------------------------------
        */
        $this->crud->addButtonFromModelFunction('line', 'open', 'getOpenButton', 'beginning');
    }
}

Cheers!

from pagemanager.

de-raaf-media avatar de-raaf-media commented on August 22, 2024

Still not able to override fillable fields. I now use the "extra" column for storing an image. And actually that is working fine.

from pagemanager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.