1. return redirect()->back()->withSuccess("成功");  return redirect()->back()->withErrors(‘失败’);

2.orm基本可以做所有的单表操作了,当然也可以做left right操作,但是要慎用。

3.软删除在建模的时候要设计到,其实就是在db里面加了一个状态码,和我之前设计的模式是一样的。

4.orm插入之前记得unset token和method unset($data['_token']); unset($data['_method']);

$users = DB::table('users')
->leftJoin('role_user','users.id','=','role_user.user_id')
->leftJoin('roles','roles.id','=','role_user.role_id')
->select('users.*','roles.display_name as role_name')
->where('roles.name','like',$group.'%')
->orderby('created_at','desc')
->paginate(25);
return response()->download(
realpath(storage_path('app')).'/'.$file_info[0]['file_path'],
$file_info[0]['file_name']
);
Storage::disk()->exists($file_info[0]['file_path']);
Storage::put(
$savePath,
file_get_contents($file->getRealPath())
);
$data = DB::table('material')
->leftJoin('users', 'users.id', '=', 'material.author')
->leftJoin('role_user','users.id','=','role_user.user_id')
->leftJoin('roles','roles.id','=','role_user.role_id')
->select('material.*','roles.name as role_name','users.name as username')
->where('material.created_at','>=',isset($conf['start_date'])?"{$conf['start_date']}":"2016-01-11 00:00:00")
->where('material.created_at','<=',isset($conf['end_date'])? "{$conf['end_date']}":"$now")
->where('material.created_at','>',"$lmt_time")
->orderby('created_at','desc')
// ->where('material.name1','like',isset($conf['name'])?"{$conf['name']}%":"'%'")
->paginate(25);
$group = config('parts.file_key');
protected $fillable = ['permission_id', 'role_id'];

protected $table = "permission_role";

public $timestamps = false;
protected $table = 'users';

/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['name', 'email', 'password', 'addr', 'phone'];

/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
@if(Session::has('errors'))
<div id="errors-message" class="alert alert-danger alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h4><i class="icon fa fa-ban"></i> 错误提示!</h4>
@foreach($errors->all() as $error)
{{$error}}
@endforeach
</div>
@endif

5.