Home >PHP Framework >Laravel >How to create and use laravel framework model model

How to create and use laravel framework model model

不言
不言Original
2018-08-03 14:35:2612234browse

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 &#39;member name is sean&#39;;
	}
}

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn