Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of laravel Code hints in PHP Development Framework

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "PHP development framework laravel code hint problem how to solve", in the daily operation, I believe that many people in the PHP development framework laravel code hint problem how to solve the problem have doubts, Xiaobian consulted all kinds of materials, sorted out a simple and useful method of operation, hope to answer the "PHP development framework laravel code hint problem how to solve" the doubt is helpful! Next, please follow the editor to study!

Public function getTable () {return $this- > table? Str::snake (Str::pluralStudly (class_basename ($this));} class_basename takes the class name corresponding to the instance, pluralStudly, converts the class name to plural snake, and converts the hump into an underlined format.

Here is the default according to the class name underlined plus plural recommendation not to change, but if you delete the plural can also get the table name

Public function getTable () {return $this- > table? Str::snake (class_basename ($this));} / / convert deleted to Boolean public $defaultCasts = ['deleted' = >' boolean']; public function _ construct (array $attributes = []) {parent::__construct ($attributes); parent::mergeCasts ($this- > defaultCasts);}

Will merge the data into the

Ide optimized code hint this is an ide hint extension package

Install this package

Composer require-dev barryvdh/laravel-ide-helper

Three ways to use

Yes generates class files directly. No is not generated and there are hints, but there will be some weird saving information.

If there is no prompt to delete the status of the comment information, there will be a prompt.

If there is a hint of tilde, just use query directly.

Help find the source code of the facade

You can prompt the message of the alias.

At this point, the study on "how to solve the problem of laravel code hints in PHP development framework" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report