vanilophp / framework

The truly Laravel E-commerce Framework
https://vanilo.io
MIT License
810 stars 102 forks source link

Customizable items per page pagination in admin interface #104

Open damarev opened 3 years ago

damarev commented 3 years ago

Currently items per page pagination in admin interface is harcoded in controllers to 100 items per page (ChannelController, OrderController, ProductController and PropertyController), which seems a little bit too much.

It would be nice to have this value configurable, I see two possible approches:

Option 1. Via a config setting in config/concord.php, like:

return [
    'modules' => [
        Vanilo\Framework\Providers\ModuleServiceProvider::class => [
            'pagination' => [
                'order' => 25,
            ],
        ],
    ]
];

and then in src/Http/Controllers/OrderController.php

return view('vanilo::order.index', [
    'orders' => $query->paginate(config('vanilo.framework.pagination.order',100)),
    'inactives' => $inactives,
]);

Option 2. Or maybe a simpler and global solution would be to just use the default eloquent pagination of 15 items:

return view('vanilo::order.index', [
    'orders' => $query->paginate(),
    'inactives' => $inactives,
]);

And override this seeting via custom model as described in documentation:

namespace App;

use Vanilo\Framework\Models\Order as BaseOrder;

class Order extends BaseOrder 
{
    protected $perPage = 25;
}

How does that sound?

fulopattila122 commented 3 years ago

Hey, sorry for the slow reaction. Yep, it completely makes sense.

The only reason why I'm reluctant to add it (to the framework) is that most people want to use the framework without the admin. So it'll be decoupled soon, in a backward-compatible manner.

The effect of the decoupling to this particular initiative is solely naming, the config will be vanilo.admin instead of vanilo.framework.

davidkvasnovsky commented 3 years ago

Hey, sorry for the slow reaction. Yep, it completely makes sense.

The only reason why I'm reluctant to add it (to the framework) is that most people want to use the framework without the admin. So it'll be decoupled soon, in a backward-compatible manner.

The effect of the decoupling to this particular initiative is solely naming, the config will be vanilo.admin instead of vanilo.framework.

Hey!

according to roadmap (https://vanilo.io/docs/2.x/roadmap), when do you plan to decouple framework and admin?

Thanks.