当前位置:网站首页>Laravel - model (new model and use model)
Laravel - model (new model and use model)
2022-07-05 13:54:00 【Weichi Begonia】
stay app New file in directory member.php As a model file :
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Member extends Model{
public static function getMember(){
return 'member name is tom';
}
}stay controller At the time of invocation , because member.php Medium getMember Is a static method , It can be used directly Class name :: Function name To make a call :
<?php
namespace App\Http\Controllers;
use App\Member;
use Illuminate\Http\Request;
class MemberController extends Controller
{
public function info(Request $request, $id){
return Member::getMember(); // How to call static functions
}
}
边栏推荐
- [machine learning notes] several methods of splitting data into training sets and test sets
- What about data leakage? " Watson k'7 moves to eliminate security threats
- Controller in laravel framework
- [server data recovery] a case of RAID5 data recovery stored in a brand of server
- Kafaka log collection
- The real king of caching, Google guava is just a brother
- Brief introduction to revolutionary neural networks
- Etcd database source code analysis -- rawnode simple package
- Idea remote debugging agent
- Zhubo Huangyu: it's really bad not to understand these gold frying skills
猜你喜欢

Liar report query collection network PHP source code

Embedded software architecture design - message interaction

内网穿透工具 netapp

Idea remote debugging agent

zabbix 监控
Jetpack compose introduction to mastery

Data Lake (VII): Iceberg concept and review what is a data Lake

常见问题之PHP——Fatal error: Allowed memory size of 314572800 bytes exhausted...

What happened to the communication industry in the first half of this year?

Redis6 transaction and locking mechanism
随机推荐
RK3566添加LED
Rk3566 add LED
matlab学习2022.7.4
Laravel dompdf exports PDF, and the problem of Chinese garbled code is solved
Record in-depth learning - some bug handling
How to apply the updated fluent 3.0 to applet development
【华南理工大学】考研初试复试资料分享
2022 machine fitter (Advanced) test question simulation test question bank simulation test platform operation
ELFK部署
Laravel framework operation error: no application encryption key has been specified
ZABBIX monitoring
Datapipeline was selected into the 2022 digital intelligence atlas and database development report of China Academy of communications and communications
Apicloud studio3 WiFi real machine synchronization and WiFi real machine preview instructions
Assembly language - Beginner's introduction
研究生可以不用学英语?只要考研英语或六级分数高!
Solution to the prompt of could not close zip file during phpword use
How to divide a large 'tar' archive file into multiple files of a specific size
Programmer growth Chapter 8: do a good job of testing
Personal component - message prompt
Scientific running robot pancakeswap clip robot latest detailed tutorial