Giter Site home page Giter Site logo

Comments (6)

arrilot avatar arrilot commented on July 23, 2024

Do you have a use case where built-in stub is not good enough?

from laravel-widgets.

arrilot avatar arrilot commented on July 23, 2024

It's not hard to implement but I don't quite see the value of this customization.

from laravel-widgets.

zorx avatar zorx commented on July 23, 2024

Right now we can only use a run method under the widget class, but in my use case, I would like to have two methods run and setting because I'm trying to create a system that offers the admin the possiblity to configure the widget from UI.

I know that this package is based only on the run method and we can't call another one from outside, that's why I opted for this :

    public function run()
    {
        if (isset($this->config['__setting'])) {
            return $this->setting();
        }else{
            return $this->render();
        }
    }

    protected function render() {
        $config = $this->config;
        // Do something and render

        return view("user.view", compact('config'));
    }

    protected function setting() {
        $config = $this->config;
        // Do something to configure
        return view("admin.view", compact('config'));
    }

that's why I have to change stubs

from laravel-widgets.

arrilot avatar arrilot commented on July 23, 2024

Thanks, makes sense.

Gonna implement it in a couple of days.

from laravel-widgets.

zorx avatar zorx commented on July 23, 2024

Awesome thanks

from laravel-widgets.

arrilot avatar arrilot commented on July 23, 2024

Done in 3.3.

from laravel-widgets.

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.