Skip to content

u/bTrixy

In this archive from Feb 2013 to Jan 2020

1
posts
64
comments
0
media
150
score

Lately I tend to use action classes when there is quite a lot of logic involved.

In this case I make a changeTeamAction and all the logic happens in there. Some are small, some have quite a lot of private functions for all the checks and errors.

Most only have 2 public functions. Those are validate and execute/create/update or whatever fits best.

https://freek.dev/1371-refactoring-to-actions

1 points

I have a difficulty understanding the question. But I'll give it a shot.

In phpMyAdmin you have a table posts. And a table post_category. And instead of having categories table. You want to place it in a configuration file.

I don't think it's possible to have a many to many relation this way. What is possible is a one to many. Then on your post_category you could have a post_id (int) and a category (string) . This way you could place all categories in a array in a config file.

Tho by doing so you limit yourself to only showing the categories for a post. While it's more likely that you also want a relationship the other way around. (Show me all posts from a certain category)

Then it's much easier to place everything in the database and make a many to many relation.

1 points

In large models I only tend to place things like fillables, casts and documentation of that model. All other stuff is in traits, ex. ModelnameScopesTrait or modelnameRelationsTrait.

Tho reading a other comments here of placing related scopes and relations together seems very interesting as well. So I might organise it like that on my next project.

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.