...為調(diào)用 subscribe 方法會(huì)啟動(dòng)一個(gè)長(zhǎng)時(shí)間運(yùn)行的進(jìn)程:<?php namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Support\Facades\Redis; class RedisSubscribe extends Command { /** * 控制臺(tái)命令的名稱和簽名 * * @var string */ protected $signature = ...
http://m.o2fo.com/laravel_8/laravel_8-epv13i0p.html...據(jù)表中插入新記錄。在開始之前,請(qǐng)確保在 config/database.php 中配置數(shù)據(jù)庫連接。更多關(guān)于數(shù)據(jù)庫配置的信息,請(qǐng)查看 文檔。
http://m.o2fo.com/laravel_8/laravel_8-5cv43i0s.html現(xiàn)在,我們來看一個(gè) Flight 模型的示例,我們將用它從 flights 數(shù)據(jù)庫表中檢索和存儲(chǔ)數(shù)據(jù)信息:<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Flight extends Model { // }
http://m.o2fo.com/laravel_8/laravel_8-y5ki3i0u.html...以通過在模型上定義 table 屬性來指定自定義數(shù)據(jù)表:<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Flight extends Model { /** * 與模型關(guān)聯(lián)的表名 * * @var string */ protected $table = 'my_flights'; }
http://m.o2fo.com/laravel_8/laravel_8-rtkz3i0v.html...屬性定義默認(rèn)值,可以在模型上定義 $attributes 屬性:<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Flight extends Model { /** * 模型屬性的默認(rèn)值 * * @var array */ protected $attributes = [ 'delayed' => false, ]; }
http://m.o2fo.com/laravel_8/laravel_8-2mhw3i0z.html...可以用它更快速的查詢與其相關(guān)聯(lián)的數(shù)據(jù)表。例如:<?php $flights = App\Models\Flight::all(); foreach ($flights as $flight) { echo $flight->name; }
http://m.o2fo.com/laravel_8/laravel_8-mq683i12.html...模型指定一個(gè)不同的連接,設(shè)置 $connection 屬性即可:<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Flight extends Model { /** * 模型的數(shù)據(jù)庫連接名 * * @var string */ protected $connection = 'connection-name'; }
http://m.o2fo.com/laravel_8/laravel_8-36et3i14.html...新模型實(shí)例,給實(shí)例設(shè)置屬性,然后調(diào)用 save 方法:<?php namespace App\Http\Controllers; use App\Http\Controllers\Controller; use App\Models\Flight; use Illuminate\Http\Request; class FlightController extends Controller { /** * 創(chuàng)建一個(gè)新實(shí)例 * * @param Request $request...
http://m.o2fo.com/laravel_8/laravel_8-4rak3i1c.html...在模型上使用 Illuminate\Database\Eloquent\SoftDeletes trait:<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class Flight extends Model { use SoftDeletes; } 技巧:SoftDeletes 會(huì)自動(dòng)將 deleted_at 屬性轉(zhuǎn)換成 DateT...
http://m.o2fo.com/laravel_8/laravel_8-p7jx3i1m.html...。 例如:讓 Flight 模型的 name 屬性可以被批量賦值:<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Flight extends Model { /** * 可批量賦值屬性 * * @var array */ protected $fillable = ['name']; } 一旦我們?cè)O(shè)置好了可以批量賦值...
http://m.o2fo.com/laravel_8/laravel_8-ft5u3i1r.html抱歉,暫時(shí)沒有相關(guān)的微課
w3cschool 建議您:
抱歉,暫時(shí)沒有相關(guān)的視頻課程
w3cschool 建議您:
抱歉,暫時(shí)沒有相關(guān)的教程
w3cschool 建議您:
...為調(diào)用 subscribe 方法會(huì)啟動(dòng)一個(gè)長(zhǎng)時(shí)間運(yùn)行的進(jìn)程:<?php namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Support\Facades\Redis; class RedisSubscribe extends Command { /** * 控制臺(tái)命令的名稱和簽名 * * @var string */ protected $signature = ...
http://m.o2fo.com/laravel_8/laravel_8-epv13i0p.html...據(jù)表中插入新記錄。在開始之前,請(qǐng)確保在 config/database.php 中配置數(shù)據(jù)庫連接。更多關(guān)于數(shù)據(jù)庫配置的信息,請(qǐng)查看 文檔。
http://m.o2fo.com/laravel_8/laravel_8-5cv43i0s.html現(xiàn)在,我們來看一個(gè) Flight 模型的示例,我們將用它從 flights 數(shù)據(jù)庫表中檢索和存儲(chǔ)數(shù)據(jù)信息:<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Flight extends Model { // }
http://m.o2fo.com/laravel_8/laravel_8-y5ki3i0u.html...以通過在模型上定義 table 屬性來指定自定義數(shù)據(jù)表:<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Flight extends Model { /** * 與模型關(guān)聯(lián)的表名 * * @var string */ protected $table = 'my_flights'; }
http://m.o2fo.com/laravel_8/laravel_8-rtkz3i0v.html...屬性定義默認(rèn)值,可以在模型上定義 $attributes 屬性:<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Flight extends Model { /** * 模型屬性的默認(rèn)值 * * @var array */ protected $attributes = [ 'delayed' => false, ]; }
http://m.o2fo.com/laravel_8/laravel_8-2mhw3i0z.html...可以用它更快速的查詢與其相關(guān)聯(lián)的數(shù)據(jù)表。例如:<?php $flights = App\Models\Flight::all(); foreach ($flights as $flight) { echo $flight->name; }
http://m.o2fo.com/laravel_8/laravel_8-mq683i12.html...模型指定一個(gè)不同的連接,設(shè)置 $connection 屬性即可:<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Flight extends Model { /** * 模型的數(shù)據(jù)庫連接名 * * @var string */ protected $connection = 'connection-name'; }
http://m.o2fo.com/laravel_8/laravel_8-36et3i14.html...新模型實(shí)例,給實(shí)例設(shè)置屬性,然后調(diào)用 save 方法:<?php namespace App\Http\Controllers; use App\Http\Controllers\Controller; use App\Models\Flight; use Illuminate\Http\Request; class FlightController extends Controller { /** * 創(chuàng)建一個(gè)新實(shí)例 * * @param Request $request...
http://m.o2fo.com/laravel_8/laravel_8-4rak3i1c.html...在模型上使用 Illuminate\Database\Eloquent\SoftDeletes trait:<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class Flight extends Model { use SoftDeletes; } 技巧:SoftDeletes 會(huì)自動(dòng)將 deleted_at 屬性轉(zhuǎn)換成 DateT...
http://m.o2fo.com/laravel_8/laravel_8-p7jx3i1m.html...。 例如:讓 Flight 模型的 name 屬性可以被批量賦值:<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Flight extends Model { /** * 可批量賦值屬性 * * @var array */ protected $fillable = ['name']; } 一旦我們?cè)O(shè)置好了可以批量賦值...
http://m.o2fo.com/laravel_8/laravel_8-ft5u3i1r.html抱歉,暫時(shí)沒有相關(guān)的文章
w3cschool 建議您: