Below you will find pages that utilize the taxonomy term “Laravel”
November 25, 2016
Laravel中的异常处理
"Eloquent try/catch on duplicate key Exception and delete?\nI’ve a form for a new vendor where the controller listens for its POST. From there on I’m creating a new endor and the equivalential login for this vendor.\nController :\n$vendor = Vendor::create( $request-\u0026gt;all() ); $login = Vendor::createLogin($vendor-\u0026gt;vendor_id); the createLogin function :\npublic static function createLogin($lid){ $name = self::find($lid)-\u0026gt;vendor_name; $name = explode(\u0026#39; \u0026#39;, $name); $vendor_login = [ …"
November 18, 2016
Laravel框架数据库CURD操作、连贯操作使用方法
"Laravel是一套简洁、优雅的PHP Web开发框架(PHP Web Framework)。它可以让你从面条一样杂乱的代码中解脱出来;它可以帮你构建一个完美的网络APP,而且每行代码都可以简洁、富于表达力。\n一、Selects\n检索表中的所有行\n$users = DB::table(\u0026#39;users\u0026#39;)-\u0026gt;get(); foreach ($users as $user) { var_dump($user-\u0026gt;name); } 从表检索单个行\n$user = DB::table(\u0026#39;users\u0026#39;)-\u0026gt;where(\u0026#39;name\u0026#39;, \u0026#39;John\u0026#39;)-\u0026gt;first(); var_dump($user-\u0026gt;name); 检索单个列的行\n$name = DB::table(\u0026#39;users\u0026#39;)-\u0026gt;where(\u0026#39;name\u0026#39;, \u0026#39;John\u0026#39;)-\u0026gt;pluck(\u0026#39;name\u0026#39;); 检索一个列值列表\n$roles = …"