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

How to create and use laravel framework model model

不言
Release: 2018-08-03 14:35:26
Original
12257 people have browsed it

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;;
	}
}
Copy after login

3. Use

<?php

namespace App\Http\Controllers;
use App\Member;
class MemberController extends Controller
{
	
	public function info($id)
	{
		//调用模型
		return Member::getMember();
	}
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template