上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 39 下一页
摘要: public function ormDelete() { # 1.通过模型删除 // $student = Student::where('id',5); // $student->delete(); # 2.通过主键值删除 ## 2.1 删除单个 // Student::destroy(14); 阅读全文
posted @ 2020-04-27 20:42 武卡卡 阅读(1808) 评论(0) 推荐(0) 编辑
摘要: public function ormUpdate() { # 1.通过模型更新数据 /* $student = Student::find(14); $student->name = '小卡'; $student->save(); */ # 2.结合查询批量更新 $student = Studen 阅读全文
posted @ 2020-04-27 20:26 武卡卡 阅读(2440) 评论(0) 推荐(0) 编辑
摘要: public function ormCreate() { # 1. 使用模型新增 ->save() /* $student = new Student(); $student->name = '大圣'; $student->age = 500; $student->sex = '猴'; $stud 阅读全文
posted @ 2020-04-27 20:16 武卡卡 阅读(393) 评论(0) 推荐(0) 编辑
摘要: Laravel 的 Eloquent ORM 提供了漂亮、简洁的 ActiveRecord 实现来和数据库进行交互。每个数据库表都有一个对应的「模型」可用来跟数据表进行交互。你可以通过模型查找数据表内的数据,以及将记录添加到数据表中。 1. 模型文件 <?php namespace App; use 阅读全文
posted @ 2020-04-27 18:53 武卡卡 阅读(1293) 评论(0) 推荐(0) 编辑
摘要: public function constructorQuery() { # 1,新增 DB::table('student')->insert([ ['name' => '王者之锤', 'age' => 18], ['name' => '地狱之眼', 'age' => 30] ]); # .... 阅读全文
posted @ 2020-04-27 18:50 武卡卡 阅读(375) 评论(0) 推荐(0) 编辑
摘要: <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; use App\Student; class studentController extends 阅读全文
posted @ 2020-04-27 15:25 武卡卡 阅读(150) 评论(0) 推荐(0) 编辑
摘要: /** * 用户添加 * @param 接收的表单数据 (name,password,id) * @return 返回添加是否成功 */ public function add(Request $req) { $input = $req->except(['_id']); // 排除_id } 阅读全文
posted @ 2020-04-26 12:44 武卡卡 阅读(1260) 评论(0) 推荐(0) 编辑
摘要: cd 到 laravel的目录中执行 就可以了 阅读全文
posted @ 2020-04-26 10:23 武卡卡 阅读(1694) 评论(0) 推荐(3) 编辑
摘要: 阅读全文
posted @ 2020-04-26 10:05 武卡卡 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 1,创建目录 ( 路径不要带有中文 ) 2,进入目录,执行下列命令 composer create-project --prefer-dist laravel/laravel project 阅读全文
posted @ 2020-04-25 20:06 武卡卡 阅读(261) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 39 下一页