Saunier, RaphaëlR. Saunier, Getting Started with Laravel 4. Packt Publishing Ltd, 2014.Raphael Saunier. Getting Started with Laravel 4. 20th January 2014Saunier 2014] Saunier, R. (2014). Getting Started with Laravel 4. Packt Publishing Ltd....
全局作用域可以给模型的查询都添加上约束。Laravel 的 软删除 功能就是利用了「未删除」的全局作用域。自定义全局作用域使用起来更方便、简单,同时保证了每一个模型的查询都受到特定约束。编写全局作用域编写全局作用域非常简单。定义一个实现 Illuminate\Database\Eloquent\Scope 接口的类,并实现 apply.这一方法。
Laravel 的 Eloquent ORM 提供了一个漂亮、简洁的 ActiveRecord 实现来和数据库交互。每个数据库表都有一个对应的「模型」用来与该表交互。你可以通过模型查询数据表中的数据,以及在数据表中插入新记录。在开始之前,请确保在 config/database.php 中配置数据库连接。更多关于数据库配置的信息,请查看 文档。
Getting started 🗺️ Laravel Lang Controlling the localization of an app is super easy 😎 Basic Usage Information on quick installation and use of packages Configuration Detailed information on setting up packages Common Easily connect the necessary language packs to the application...
Laravel provides an updateOrCreate method to do this in one step. Like the firstOrCreate method, updateOrCreate persists the model, so there's no need to call save():1// If there's a flight from Oakland to San Diego, set the price to $99. 2// If no matching model exists, ...
The Laravel schema builder contains a helper method to create this column:Schema::table('flights', function ($table) { $table->softDeletes();});Now, when you call the delete method on the model, the deleted_at column will be set to the current date and time. And, when querying a ...
The Laravel schema builder contains a helper method to create this column:1Schema::table('flights', function ($table) { 2 $table->softDeletes(); 3});Now, when you call the delete method on the model, the deleted_at column will be set to the current date and time. And, when ...
This tutorial is going to walk through getting started using Meilisearch with Laravel Scout, so you can see the difference in set ups - and make a decision which way you would like to go. As always, we will start with a fresh Laravel application - I usually use theLaravel Installeras I...
By default, Laravel's sample environment configuration is ready to use with Laravel Homestead, which is a convenient virtual machine for doing Laravel development on your local machine. Of course, you are free to modify this configuration as needed for your local database....
Laravel Create Database To connect the system to an existing database, select the “Use Database” checkbox and enter DB name, username and password. In the next dialog box, enter the server name and port. If MySQL is running on the local computer, then nothing needs to be changed at ...