gabsource / oc-scaffold-translation-plugin Goto Github PK
View Code? Open in Web Editor NEWOctoberCMS plugin that overrides default scaffold commands to generate translation aware source files
License: MIT License
OctoberCMS plugin that overrides default scaffold commands to generate translation aware source files
License: MIT License
Hi.
I use your plugin a lot so I've created an included a polish translation file. Hope you'll find this usefull.
Hi,
actually this is a useful plugin, but all the calls to trans()
are unneccessary. October will automatically look up these in the language files - there is no need for the trans in Components, Plugin-files, etc
Example: https://github.com/rainlab/blog-plugin/blob/master/components/Categories.php#L30-L31
Hello,
Thank you for your awesome plugin. I've got a question though, can bring PR if you are willing.
Basically, you scaffold controller with delete button and onDelete method like this:
public function index_onDelete()
{
if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
foreach ($checkedIds as ${{lower_singular_model}}Id) {
if (!${{lower_singular_model}} = {{model}}::find(${{lower_singular_model}}Id)) continue;
${{lower_singular_model}}->delete();
}
}
(...)
}
and it does what should rarely be done: makes singular queries in loop, also loads whole model with find and does some non required checks. That makes it super slow, for 120 records at once I've got like 5 seconds deletion time.
My suggestion would be to use:
if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
{{model}}::whereIn('id', $checkedIds)->delete();
}
so results would be like
if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
Model::whereIn('id', $checkedIds)->delete();
}
Rationale:
Loop method for 120 records: 5116 ms (red on screenshot)
Wherein method for 120 records: 121ms (green on screenshot)
Let me know if you would be willing to accept PR for this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.