/** * @param Request $request * @return Inventory[] */ public function index(Request $request) { $inventories = Inventory::query(); if ($request->has('repo_id')) { $inventories->where("repo_id", $request->get('repo_id')); } return $inventories->get(); }
/** * Run the migrations. * * @return void */ public function up() { \Schema::table('inventories', function (Blueprint $table) { $table->text('public_key')->nullable(); $table->text('private_key')->nullable(); }); // generates keys for all inventories foreach (\App\Model\Inventory::all() as $inv) { $inv->save(); } }
public function delete($id) { Inventory::find($id)->delete(); return redirect("/dream/inventory")->with('message', '信息删除成功!'); }