How to implement categories in laravel?

There are categories, and there are news, publications and the like. This raises the question of how to combine them. Enough fields "categories" in the table of publications, either make a separate table publication_category (publication_id | category_id) that holds categories to which an entry belongs to.
The first option is sort of right and according to the rules of normal forms, and easier to use (it is not necessary to determine the category of a string and further search) and the second variant stores less information, but will have to take additional treatment.

And then there is the second question. I don't know why, but I did a dynamic address from the admin panel (and all the system settings I have in the dB) and now I have a problem with that, because in some places, and in particular the controllers. Is it possible the settings in the database be moved to a separate config? The problem is that I can't do queries to dB in the configs and it fails to make it.
July 2nd 19 at 17:27
1 answer
July 2nd 19 at 17:29
As for categories, most recently wrote on the subject to the question of How to bring all the posts from categories?.

On the second question - can. Use for this configuration.

Create example file config/cms.php:

return [
 'news_per_page' => 10
]

And get this value from anywhere in the program using the auxiliary functions:

config('cms.news_per_page');
What is written in the topic does not describe the difference between the approaches. As for the configurations, as I wrote, it is not allowed to make requests. Only as an option when saving the settings to write to the config file. - Eula.Quigley commented on July 2nd 19 at 17:32
Structure - anything extra will not say. This is correct, at the primary level. Multicategory for items and the opportunity to work with such categories (relations) by means of standard Laravel.

As for configuration - generate correctly the question, — Can the settings from the database to be moved to separate config? — I answered above, and you explained how to do it. Create this file dynamically if there is a need, what's the problem?

:-) - Buddy commented on July 2nd 19 at 17:35

Find more questions by tags LaravelMySQLPHP