Tag:eloquent

  • Laravel data migration and implementation of eloquent ORM

    Time:2020-3-3

    Introducer Database is the most common and important part of back-end development. Laravel provides a very practical eloquent ORM model class, which is simple and intuitive to interact with the database. At the same time, data migration management database can be used for sharing and editing with the team. For more information on both, please […]

  • Laravel5.7 eloquent ORM quick start walkthrough

    Time:2020-3-2

    brief introduction Laravel’s built-in eloquent ORM provides a beautiful and simple activerecord implementation for dealing with the database. Each data table corresponds to a model that interacts with the table. Through the model class, you can query, insert, update, delete and other operations on the data table. Before you start, make sure that the database […]

  • New version 2.0 of gorose of orm in go language

    Time:2020-2-6

    Laravel’s eloquent, known as go language version, has released version 2.0 which has been long lost. The new version has made great improvements and upgrades. Let’s take a look at the features of the new version Structural adjustment Gorose version 2.0 has been completely restructured with a new architecture, as shown in the figure below: […]

  • Gorose version 2.0 of golang ORM officially released

    Time:2019-12-3

    About gorose 2.0 Gorose, the most popular golang ORM, and the PHP version of laravel eloquentAfter several months of refactoring and polishing, plus nearly a month of preview testing and improvement, the official version of gorose 2.0 finally met usMajor changes and upgrades have been made in the new version, which completely reconstructs the infrastructure […]

  • Laravel 9 infrequent tips

    Time:2019-9-13

    1. Update parent tabletimestamps If you want to update the parent table while updating the associated tabletimestampsYou just need to associate the tablemodelAdd intouchesAttribute.For example, we havePostandCommentTwo Relevance Models <?php namespace App; use Illuminate\Database\Eloquent\Model; class Comment extends Model { /** * All associated tables to be updated * * @var array */ protected $touches = […]

  • Ten useful uses of Laravel

    Time:2019-9-7

    1. infindMethod specifies attributes User::find(1, [‘name’, ’email’]); User::findOrFail(1, [‘name’, ’email’]); 2. CloneOneModel usereplicateThe method can clone oneModel $user = User::find(1); $newUser = $user->replicate(); $newUser->save(); 3. Judge twoModelIs it the same? Check twoModelIs ID the same?isMethod $user = User::find(1); $sameUser = User::find(1); $diffUser = User::find(2); $user->is($sameUser); // true $user->is($diffUser); // false; 4. Reload oneModel $user = […]

  • Gorose 2.0, a new version of go language orm, is released in a low profile

    Time:2019-7-16

    Laravel’s eloquent, known as go language version, has released version 2.0, which has long been lost. The new version has been greatly improved and upgraded. Let’s take a look at the features of the new version. Structural adjustment The gorose 2.0 version has been thoroughly refactored and has a completely new architecture. The architecture is […]

  • Building your own PHP framework step by step with Composer (4) – Using ORM

    Time:2019-5-26

    The original article was published on my personal website: using Composer to build your own PHP framework step by step (4) – using ORM See https://github.com/johnlui/My-First-Framework-based-on-Composer for sample code for this tutorial review After the first three articlesBasic preparation、Building routingandDesign MVCWe’ve got a PHP micro-framework with a relatively complete MVC architecture, but there’s still one […]

  • Wing CI — Using Laravel Eloquent ORM in CodeIgniter 2

    Time:2019-5-22

    Explain The original article was published on my personal website: Wing CI — Using Laravel Eloquent ORM in CodeIgniter 2 See https://github.com/johnlui/CodeIgniter-2-with-Eloquent for sample code for this tutorial Background introduction The CodeIgniter and Laravel frameworks can be seen as the dominant PHP frameworks in the past few years and in the past two years, with […]

  • Laravel Framework Model Object to JSON String Lost Update

    Time:2019-4-18

    Scenario reduction UserModel class UserModel extends Model { public function role() { return $this->belognsTo(RoleModel::class , ‘role_id’ , ‘id’); } } Error Procedure $user = UserModel::with(‘role’)->find(1); // user – > role is a RoleModel // Update role attributes $user->role = ‘test’; // Output test correctly var_dump($user->role); // But!! After converting to JSON string // You will […]

  • Yaf-example

    Time:2019-4-7

    Yaf is a PHP framework written in C language by Brother Bird. Yaf document address: http://yaf.laruence.com/manual/ In fact, I contacted Yaf a long time ago, but I just learned and didn’t understand and use it in depth. However, due to the recent reconstruction of a project, and the framework used in the reconstruction is the […]