查询,必须use Illuminate\Support\Facades\DB;
查询单条数据
ajax_joinus(Request (-> input();
['s_aid'] = ->input('aid' ['s_Name'] = ->input('username' ['s_Tel'] = ->input('tel' ['s_Company'] = ->input('company' ['s_Job'] = ->input('job' ['s_Email'] = ->input('email' ['s_Time'] = ("Y-m-d H:i:s" ['s_Ip'] = -> 查询数据表中同一个活动ID下有没有同一个电话号码报名的
->first();
(
response()->json(['code'=>201,'msg'=>'请勿重复提交' } 数据库
= DB::table('activity_signup')->insert( ( response()->json(['code'=>200,'msg'=>'提交成功' } response()->json(['code'=>300,'msg'=>'提交失败'
}
解释下哈,这里是前台模板提交ajax提交来的post方式数据,这里我没有用到Model层,也就是Model层逻辑在Controller里写了,这也是可以的哈
查询多条数据用
方法
= '文章标题1' where("s_aid",1)->get();
dd(
view('home.index.ceshi')->with('titles',
}
打印结果如下
4042e7ffdaf0cec1a9863f2559435.png" alt="">
原文链接:https://www.f2er.com/laravel/69660.html