octobercms-backend

OctoberCMS - Update a field in a related table when inserting

和自甴很熟 提交于 2021-02-11 13:23:29
问题 In OctoberCMS, I have three tables: Students, Courses and Subscriptions (studentID, courseID, active) When student subscribes to a course, it's not activated until the admin activate it. That is logical. But When admin opens a course form from backend, he can select students to subscribe in this course, then they are added to subscriptions table. Here I would like to update the field: active automatically. How can I dot that? I wrote this code, but it didn't work: public function afterSave()

Relation Manager Not Showing Pivot Data

你离开我真会死。 提交于 2020-04-17 21:53:52
问题 So this question came about because of this other question I was looking into. So I have dabbled in this a bit working with backend forms and thought I knew how to tackle this. However I am not seeing the results that I thought I would. I have tried to do some research and haven't seen anyone bring this up in the issues on the github page or here in stackoverflow. Unless I missed it. How do you show the stored extra Pivot Data in the backend? Here is my model.php relationship: public

Relation Manager Not Showing Pivot Data

左心房为你撑大大i 提交于 2020-04-17 21:53:46
问题 So this question came about because of this other question I was looking into. So I have dabbled in this a bit working with backend forms and thought I knew how to tackle this. However I am not seeing the results that I thought I would. I have tried to do some research and haven't seen anyone bring this up in the issues on the github page or here in stackoverflow. Unless I missed it. How do you show the stored extra Pivot Data in the backend? Here is my model.php relationship: public

Relation Manager Not Showing Pivot Data

∥☆過路亽.° 提交于 2020-04-17 21:53:13
问题 So this question came about because of this other question I was looking into. So I have dabbled in this a bit working with backend forms and thought I knew how to tackle this. However I am not seeing the results that I thought I would. I have tried to do some research and haven't seen anyone bring this up in the issues on the github page or here in stackoverflow. Unless I missed it. How do you show the stored extra Pivot Data in the backend? Here is my model.php relationship: public

relationship between user and category OctoberCMS

半腔热情 提交于 2020-01-06 07:52:48
问题 how to establish a relationship between the user and the category? A category has more than one user, and a user belongs to a category I add category_id in the user table on the frontend I display the list of users with the plugin builder but I also want to display the category of the user I use the RainLab user plugin Help me please, thank you in advance 回答1: it seems you need to extend user model and add category relation runtime You need to add this code to your plugin's boot method public

October CMS disallowed file types

强颜欢笑 提交于 2019-12-24 07:05:14
问题 I'm trying to upload a .pptx file to the media library in October CMS and I'm getting an error because the filetype is not allowed. I have tried using the following suggestion from Stackoverflow: 'fileDefinitions' => [ 'assetExtensions' => array_merge(FileDefinitions::get('assetExtensions'), ['docx']), ], But I get an error message about FileDefinitions class not existing. I have also tried another suggestion of adding to a fileTypes array in /config/cms.php but that doesn't work either as

OctoberCMS plugin show all the validations at once

戏子无情 提交于 2019-12-24 06:06:49
问题 I am using Builder plugin to create plugins and did field validations in my model in one of my plugins which works fine. Let's say I have a validation something like this in one my plugin call it as Team . Model File: technobrave\team\models\Team.php <?php namespace Technobrave\Team\Models; use Model; /** * Model */ class Team extends Model { use \October\Rain\Database\Traits\Validation; /* * Validation */ public $rules = [ 'name' => 'required|unique:technobrave_team_', 'photo' => 'required',

October CMS - Display only those records that are attached to the groups of the current user

拜拜、爱过 提交于 2019-12-23 05:06:33
问题 I need to display only those records in the model that are attached to some groups. ("belongsToMany" Relations). (backend page of plugin list of Movies model) I want to get the groups of the current user and create a query. What I mean: I use Relations field to to attach records to groups. i.e: I have table "elisseii_myplugin_movies". In the "Movies" model, I created a relation field with the name "groups". and created the table "elisseii_myplugin_movies_groups". Used $belongsToMany in the

Octobercms: How can I make a repeater field jsonable because I am creating this repeater field into a different plugin

点点圈 提交于 2019-12-22 16:36:47
问题 How can I make a repeater field jsonable because I am creating this repeater field into a different plugin and I have created my own plugin. for example: I want to add a repeater field in rainlab.user plugin model but I want to do this by my own plugin so updates on rainlab.user plugin won't affect my work. Thanks 回答1: You should read about Extending Plugins. 1) First register the events in your custom plugin.php - Example 2) Add the related fields to your migration file - Example - Make sure

Octobercms: How can I make a repeater field jsonable because I am creating this repeater field into a different plugin

試著忘記壹切 提交于 2019-12-22 16:31:56
问题 How can I make a repeater field jsonable because I am creating this repeater field into a different plugin and I have created my own plugin. for example: I want to add a repeater field in rainlab.user plugin model but I want to do this by my own plugin so updates on rainlab.user plugin won't affect my work. Thanks 回答1: You should read about Extending Plugins. 1) First register the events in your custom plugin.php - Example 2) Add the related fields to your migration file - Example - Make sure