Laravel创建模型
laravel中创建模型
<?php
/**
* Created by PhpStorm.
* 新建模型
* User: chuang
* Date: 17-1-15
* Time: 上午9:14
*/
namespace App\Http\Model;
use Illuminate\Database\Eloquent\Model;
class Member extends Model
{
public static function getName(){
return 'my name is bigz';
}
}
laravel中使用模型
<?php
/**
* Created by PhpStorm.
* User: chuang
* Date: 17-1-14
* Time: 下午4:29
*/
namespace App\Http\Controllers;
class User extends Controller
{
public function getName(){
//调用模型
return \App\Http\Model\Member::getName();
}
}