Home >PHP Framework >Laravel >How to create and use laravel framework model model
This article introduces to you the creation and use of laravel framework model model. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
1. Create model
##2.<?php namespace App; use Illuminate\Database\Eloquent\Model; class Member extends Model { public static function getMember() { return 'member name is sean'; } }3. Use
<?php namespace App\Http\Controllers; use App\Member; class MemberController extends Controller { public function info($id) { //调用模型 return Member::getMember(); } }in the controller Related articles Recommendation:
Introduction to code examples of routing in laravel
How to customize the analysis of log behavior in Laravel5.5
The above is the detailed content of How to create and use laravel framework model model. For more information, please follow other related articles on the PHP Chinese website!