#### Category : octobercms

Does anyone have an example GET request using the Http package in OctoberCMS? I can’t find an example anywhere of a full request. Here is the documentation: https://octobercms.com/docs/api/october/rain/network/readme Sourc..

Morning all, I am trying to create a command that I can schedule to check if a certification date has expired and if it has, update the boolean from 0 to 1. I have never used commands before and I have read the OctoberCMS documentation but I found it confusing. If anyone could help me, ..

I want to make an input in the admin panel with which you can increase / decrease prices in several tables in db by %. At the moment, I did it through a filter { return [ new TwigSimpleFilter(‘price_kiev’, [$this, ‘formatPriceKiev’]) ]; } public function getPriceEditKiev() {$result = DB::table(‘another_pricelist_edit’)->select(‘price_edit_kiev’)->where(‘id’, 1)->first(); return $result->price_edit_kiev; } public .. Read more I have this form with steps, on each step the form submits and return results via AJAX. When the user selects the first step, the second step is activated and the user is presented with three options, those options may or may not contain further results depending on the user choice. The thing is I .. Read more I am use OctoberCMS Rainlab.User plugin to manage authentication. I have various models and that belongTo User. How do i set up an anonymous global scope on each model to only return the records that belong to the authenticated user? Many thanks in advance for any help. use Auth; protected static function booted() {$user ..

I’m working on a project using OctoberCMS and for the database I want to use MongoDB. but i have problem while migrating. when the migrate collection fails. please help so i can solve the problem. thank you. Sourc..

I am trying to loop through records and total up the price values. Model: Certfication Field: price My loop looks like this: {% set price = 0 %} {% for item in certifications %} {% set price = item.price.count %} {% endfor %} and then i would use {{ price }} to display the total ..

here is a function I have for creating a new Contact. It works fine and as expected. What I would like to know is if there is a better way or best practice to simplify and improve the code. I am simply looking to improve my skills and build more efficient functions. public function onSave() ..

Morning all, I am trying to create a button that will copy the organisation address and populate the organisation billing address fields. I have no idea where to start. The fields in question are: // I want to copy these values $organisation->email = Input::get(’email’);$organisation->line_1 = Input::get(‘line_1’); $organisation->line_2 = Input::get(‘line_2’);$organisation->line_3 = Input::get(‘line_3’); $organisation->city = .. Read more I am attempting to create a function that will duplicate an existing record using the laravel ‘replicate’ method. Here is what I what but it’s not working as expected. updateContact.php use CmsClassesComponentBase; use Input; use Validator; use Redirect; use ItinifyItinifyModelsContact; use ItinifyItinifyModelsOrganisation; use CarbonCarbon; public function replicateRecord() {$contact = Contact::find($this->param(‘id’));$newContact = $contact->replicate();$newContact->created_at ..

I have 3 models. Quote Status Event 1 Quote belongs to 1 Status and 1 Event. However Status and Event can have many Quote. How do i set this relationship up? Here is an example: I create a new quote and select ‘Active’ as the Status and the Event as ‘Golf’ Sourc..

In my OctoberCMS application, I want to change a repeater value depend on another field value change. But it’s not working in the filterFields model method or formExtendRefreshFields controller method. I am trying like bellow, public function filterFields($fields,$context = null) { $fields->item_details->value = [my prepared array value]; } all other property like label, comments .. Read more Show "slug" category in Post: {{ post.categories[0].slug }} But, how to add this "slug" to ‘activeMenuItem’? function onInit() {$this[‘activeMenuItem’] = ???; } Thanks! Sourc..

I am using PHP Laravel and Twig the php function has a parameter as the following: function onItemApprove($id){ … } the twig has the following code : {{ form_ajax(‘onItemApprove’) }} I want to pass the parameter$id in the twig form_ajax Sourc..

I have a model which has multiple one to many relations within it. I would like to enable functionality so that when a specific relation is created onRelationManageCreate, code is executed but not when the other relations are created. Example: When an invoice is created through relation widget no extra code is executed. When a ..

It was working fine before but now my assets are not loading anymore. I am working locally with Laragon. These are the errors I get, but if I follow the paths, the files are exisiting. Thanx in advance, Sander [Sat Jul 10 13:52:31 2021] 127.0.0.1:64167 [404]: /themes/dodojayaraditya-dodo-jaya-raditya-one-tailwind/assets/css/stailwind.css – No such file or directory [Sat Jul ..

When creating a new record for my plugin with file upload it returns this error: "array_flip() expects parameter 1 to be array, null given" on line 86 of /var/www/html/october-cms/solas/vendor/october/rain/src/Database/Behaviors/Purgeable.php I already included the field to the model in public $attachOne and removed the field on the database. How can I save files and images. Source: .. Read more I want to develop a plugin that extends RainLab.Blog in October CMS. My plugin’s database appears in the SQL database and backend form that takes the new input while editing a blog post renders just fine, but the issue appears when trying to save the changes to SQL, wheree they appear NULL: "Method OleMolBlogExtensionsModelsExtension::__toString() must .. Read more I need to automatically fill form fileds (name, surname, year and checkbox group sports after manually filled the email field. defaulty is only email field enabled for writing and others fields are disabled for manual filling checkbox group sports is empty after filling the email ( [email protected] ) others fields will be filling automatically and .. Read more I must update my currency rate and I have this in my Plugin.php: {$schedule->call(function () { $url = "https://cbu.uz/ru/services/open_data/rates/json/";$json = json_decode(file_get_contents($url), true); file_put_contents("currency.json", json_encode($json[0][‘G4’])); })->everyMinute(); } I ran my cron job in cpanel /usr/local/bin/ea-php72 /var/www/u1041398/public_html/agroparts.uz/artisan schedule:run >> /dev/null 2>&1 Path is correct I checked php version it is correct also. My cron codes ..

I have a problem displaying the default.htm file of the component I created. I can drag and drop the component into a page or partial but will not display anything. What I currently have: Component called {% component ‘researchResources’ %} it is already listed in the components menu Problem: When I drag and drop the ..

OctoberCMS (472), Laravel: I would like to the "visitors" [integer] increment by one after every reload. function onStart(){ ModelName::where(‘slug’, ‘=’, $this->param(‘slug’))->increment(‘visitors’); } After that I reload the page, visitors increment by two, not with one. Why? I can’t understand. When I try increment(‘visitors’, 2) – incremented by four. How and why? Sourc.. Read more I must create new table in octobercms project and I followed documentation and added new migration file inside plugin update file I have create_currency_rates_table.php file and it has this codes <?php namespace RainLabUserUpdates; use Schema; use OctoberRainDatabaseUpdatesMigration; class CreateCurrencyRateTable extends Migration { public function up() { Schema::create(‘currency_rates’, function($table) { $table->engine = ‘InnoDB’;$table->increments(‘id’); \$table->string(‘currency’); }); ..