October CMS Custom Plugin Development

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1212
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    815

Development of Custom Plugin for October CMS

October CMS plugins are Laravel packages that extend functionality through component registration, models, routes, backend controllers. One plugin can contain all project business logic.

Generation via Builder

php artisan create:plugin MyCompany.MySite

Plugin Structure

plugins/mycompany/mysite/
├── Plugin.php              # registration of everything
├── composer.json
├── models/
│   ├── Review.php
│   └── Review/
│       ├── columns.yaml    # backend list
│       └── fields.yaml     # edit form
├── components/
│   └── ReviewList.php
├── controllers/
│   └── Reviews.php         # backend controller
├── views/
│   └── reviews/
│       └── index.htm
├── updates/
│   ├── version.yaml
│   └── 1_0_1_create_reviews_table.php
└── lang/
    ├── en/lang.php
    └── ru/lang.php

Plugin.php — Registration Point

// Plugin.php
namespace MyCompany\MySite;

use Backend;
use System\Classes\PluginBase;

class Plugin extends PluginBase
{
    public function pluginDetails(): array
    {
        return [
            'name'        => 'My Site',
            'description' => 'Site-specific functionality',
            'author'      => 'My Company',
            'icon'        => 'icon-leaf',
        ];
    }

    public function registerComponents(): array
    {
        return [
            \MyCompany\MySite\Components\ReviewList::class => 'reviewList',
            \MyCompany\MySite\Components\ReviewForm::class => 'reviewForm',
        ];
    }

    public function registerNavigation(): array
    {
        return [
            'mysite' => [
                'label'       => 'My Site',
                'url'         => Backend::url('mycompany/mysite/reviews'),
                'icon'        => 'icon-star',
                'permissions' => ['mycompany.mysite.*'],
                'order'       => 500,
                'sideMenu'    => [
                    'reviews' => [
                        'label'       => 'Reviews',
                        'icon'        => 'icon-comments',
                        'url'         => Backend::url('mycompany/mysite/reviews'),
                        'permissions' => ['mycompany.mysite.reviews'],
                    ],
                ],
            ],
        ];
    }

    public function registerSettings(): array
    {
        return [
            'settings' => [
                'label'       => 'My Site Settings',
                'description' => 'Configure My Site plugin',
                'icon'        => 'icon-cog',
                'class'       => \MyCompany\MySite\Models\Settings::class,
                'order'       => 500,
            ],
        ];
    }

    public function boot(): void
    {
        // Subscribe to events
        \Event::listen('cms.page.beforeDisplay', function ($controller, $url, $page) {
            // Logic before page render
        });
    }
}

Model with Eloquent

// models/Review.php
namespace MyCompany\MySite\Models;

use Model;

class Review extends Model
{
    use \October\Rain\Database\Traits\Validation;
    use \October\Rain\Database\Traits\SoftDelete;

    public $table = 'mycompany_mysite_reviews';

    public $rules = [
        'author_name' => 'required|string|max:255',
        'email'       => 'required|email',
        'rating'      => 'required|integer|between:1,5',
        'body'        => 'required|string|min:10',
    ];

    protected $fillable = ['author_name', 'email', 'rating', 'body', 'is_approved'];

    protected $casts = [
        'is_approved' => 'boolean',
        'rating'      => 'integer',
    ];

    public $attachOne = [
        'avatar' => \System\Models\File::class,
    ];

    public $belongsTo = [
        'product' => [\MyCompany\MySite\Models\Product::class],
    ];

    public function scopeApproved($query)
    {
        return $query->where('is_approved', true);
    }

    public function scopeByProduct($query, int $productId)
    {
        return $query->where('product_id', $productId);
    }
}

Component

// components/ReviewList.php
namespace MyCompany\MySite\Components;

use Cms\Classes\ComponentBase;
use MyCompany\MySite\Models\Review;

class ReviewList extends ComponentBase
{
    public function componentDetails(): array
    {
        return [
            'name'        => 'Review List',
            'description' => 'Displays product reviews',
        ];
    }

    public function defineProperties(): array
    {
        return [
            'productId' => ['title' => 'Product ID', 'type' => 'string'],
            'limit'     => ['title' => 'Limit', 'type' => 'string', 'default' => '10'],
        ];
    }

    public function onRun(): void
    {
        $this->page['reviews'] = Review::approved()
            ->byProduct((int) $this->property('productId'))
            ->with('avatar')
            ->orderBy('created_at', 'desc')
            ->limit((int) $this->property('limit'))
            ->get();

        $this->page['avgRating'] = Review::approved()
            ->byProduct((int) $this->property('productId'))
            ->avg('rating');
    }

    public function onSubmitReview(): array
    {
        $data = post();
        $review = new Review($data);
        $review->product_id = $this->property('productId');

        if (!$review->save()) {
            throw new \ValidationException($review);
        }

        return ['success' => true];
    }
}

Migration

// updates/1_0_1_create_reviews_table.php
use October\Rain\Database\Schema\Blueprint;
use October\Rain\Database\Updates\Migration;

class CreateReviewsTable extends Migration
{
    public function up(): void
    {
        Schema::create('mycompany_mysite_reviews', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('product_id')->unsigned()->index();
            $table->string('author_name');
            $table->string('email');
            $table->tinyInteger('rating');
            $table->text('body');
            $table->boolean('is_approved')->default(false);
            $table->timestamps();
            $table->softDeletes();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('mycompany_mysite_reviews');
    }
}

Development of a plugin with 1–2 models, components and backend interface takes 3–7 days.