当前位置:网站首页>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
}
}
边栏推荐
- js 从一个数组对象中取key 和value组成一个新的对象
- MySQL if else use case use
- Resttemplate details
- Source code analysis of etcd database -- peer RT of inter cluster network layer client
- [MySQL usage Script] catch all MySQL time and date types and related operation functions (3)
- Usage, installation and use of TortoiseSVN
- 真正的缓存之王,Google Guava 只是弟弟
- Attack and defense world crypto WP
- 【华南理工大学】考研初试复试资料分享
- 53. Maximum subarray sum: give you an integer array num, please find a continuous subarray with the maximum sum (the subarray contains at least one element) and return its maximum sum.
猜你喜欢
About the problem and solution of 403 error in wampserver
French scholars: the explicability of counter attack under optimal transmission theory
我为什么支持 BAT 拆掉「AI 研究院」
面试官灵魂拷问:为什么代码规范要求 SQL 语句不要过多的 join?
NFT value and white paper acquisition
Assembly language - Beginner's introduction
荐号 | 有趣的人都在看什么?
[server data recovery] a case of RAID5 data recovery stored in a brand of server
Convolutional Neural Networks简述
研究生可以不用学英语?只要考研英语或六级分数高!
随机推荐
[public class preview]: basis and practice of video quality evaluation
Aikesheng sqle audit tool successfully completed the evaluation of "SQL quality management platform grading ability" of the Academy of communications and communications
Etcd database source code analysis -- rawnode simple package
Intranet penetration tool NetApp
Operational research 68 | the latest impact factors in 2022 were officially released. Changes in journals in the field of rapid care
LeetCode_67(二进制求和)
什么叫做信息安全?包含哪些内容?与网络安全有什么区别?
UE源码阅读[1]---由问题入手UE中的延迟渲染
js 从一个数组对象中取key 和value组成一个新的对象
How to apply the updated fluent 3.0 to applet development
[South China University of technology] information sharing of postgraduate entrance examination and re examination
[MySQL usage Script] catch all MySQL time and date types and related operation functions (3)
:: ffff:192.168.31.101 what address is it?
ETCD数据库源码分析——集群间网络层客户端peerRt
zabbix 监控
These 18 websites can make your page background cool
几款分布式数据库的对比
French scholars: the explicability of counter attack under optimal transmission theory
Pancake Bulldog robot V2 (code optimized)
Those things I didn't know until I took the postgraduate entrance examination