Code Monkey home page Code Monkey logo

Comments (3)

lee-to avatar lee-to commented on July 1, 2024 1

я сделал реализацию проверки, есть установлено ли сео путем

  if (seo()->meta()->title() != null) {
                seo()->title( 'title', true);
                seo()->description('desc', true);
                seo()->keywords('keywords', true);
            } else {
                seo()->meta()->title();
                seo()->meta()->description();
                seo()->meta()->keywords();
            }

и получаю много запросов от модуля, не подскажите в чем ошибка? Мне кажется тут достаточно 1 select, 1 inser, 1update

пример при отсутсвии сео

select * from `seo` where `url` = '/item/item555' limit 1
select * from `seo` where (`url` = '/item/item555') limit 1
insert into `seo` (`url`, `title`, `updated_at`, `created_at`) values ('/item/item555', 'dfdsgsdgsdg', '2023-05-26 09:26:57', '2023-05-26 09:26:57')
select * from `seo` where `url` = '/item/item555' limit 1
select * from `seo` where `url` = '/item/item555' limit 1
select * from `seo` where (`url` = '/item/item555') limit 1
update `seo` set `description` = 'vgfgfdgfg', `seo`.`updated_at` = '2023-05-26 09:26:58' where `id` = 10
select * from `seo` where `url` = '/item/item555' limit 1
select * from `seo` where `url` = '/item/item555' limit 1
select * from `seo` where (`url` = '/item/item555') limit 1
update `seo` set `keywords` = '5465456445454', `seo`.`updated_at` = '2023-05-26 09:26:59' where `id` = 10
select * from `seo` where `url` = '/item/item555' limit 1
select * from `seo` where `url` = '/item/item555' limit 1

Оптимизировал в апдейте 0.10.2 но вы все равно должны понимать что когда сохраняете параметр то под капотом вызывается updateOrCreate который в себя включает два запроса - select и update/insert и после update/insert кеш будет сброшен и последует запрос на данные

После фикса количество запросов сократится но они происходят только в момент сохранения, сам процесс сохранения у вас не должен быть на каждый запрос, вы должны сохранять только в случае когда мета еще не задана или ее надо изменить

from laravel-seo-by-url.

lee-to avatar lee-to commented on July 1, 2024

При заходе на страницу со статьей вызывайте seo()->title('Мета тег') и он будет выводится либо добавьте seo()->title('Мета тег', true) и также сохранится в базе и закешируется

from laravel-seo-by-url.

DifficultPhil avatar DifficultPhil commented on July 1, 2024

я сделал реализацию проверки, есть установлено ли сео путем

  if (seo()->meta()->title() != null) {
                seo()->title( 'title', true);
                seo()->description('desc', true);
                seo()->keywords('keywords', true);
            } else {
                seo()->meta()->title();
                seo()->meta()->description();
                seo()->meta()->keywords();
            }

и получаю много запросов от модуля, не подскажите в чем ошибка? Мне кажется тут достаточно 1 select, 1 inser, 1update

пример при отсутсвии сео

select * from `seo` where `url` = '/item/item555' limit 1
select * from `seo` where (`url` = '/item/item555') limit 1
insert into `seo` (`url`, `title`, `updated_at`, `created_at`) values ('/item/item555', 'dfdsgsdgsdg', '2023-05-26 09:26:57', '2023-05-26 09:26:57')
select * from `seo` where `url` = '/item/item555' limit 1
select * from `seo` where `url` = '/item/item555' limit 1
select * from `seo` where (`url` = '/item/item555') limit 1
update `seo` set `description` = 'vgfgfdgfg', `seo`.`updated_at` = '2023-05-26 09:26:58' where `id` = 10
select * from `seo` where `url` = '/item/item555' limit 1
select * from `seo` where `url` = '/item/item555' limit 1
select * from `seo` where (`url` = '/item/item555') limit 1
update `seo` set `keywords` = '5465456445454', `seo`.`updated_at` = '2023-05-26 09:26:59' where `id` = 10
select * from `seo` where `url` = '/item/item555' limit 1
select * from `seo` where `url` = '/item/item555' limit 1

from laravel-seo-by-url.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.