123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace Appaaa;
- use Illuminate\Database\Eloquent\Model;
- $aa = "bb";
- return;
- class Student extends Model
- {
- //指定表名 默认 模型名的复数
- protected $table = 'student';
- //指定主键 默认主键 为ID
- protected $primaryKey = 'id';
- //指定允许批量赋值的字段
- protected $fillable = ['name', 'age'];
- //指定不允许批量赋值的字段
- protected $guarded = [];
- //是否维护时间戳 默认维护
- //$timestamps=falst 不维护
- public $timestamps = true;
- //维护时间的时候保存时间戳
- protected function getDateFormat()
- {
- return time(); // TODO: Change the autogenerated stub
- }
- //查询的时候返回时间戳
- protected function asDateTime($value)
- {
- // return parent::asDateTime($value); // TODO: Change the autogenerated stub
- return $value;
- }
- }
- $students=Student::all();
- dd($students);
|