如何获取数组的元素数据?下面是我的对象Tour的数组数据。
\n某些游览可能没有tour_attendees(空数组)。
\n一场巡演将只有两条记录(参加者)。
\n#items: array:3 [\xe2\x96\xbc\n 0 => {#2115 \xe2\x96\xb6}\n 1 => {#3067 \xe2\x96\xb6}\n 2 => {#2125 \xe2\x96\xbc\n +"id": 12\n +"schedule_date": "28-11-2021"\n +"created_at": "2021-11-18T00:16:42.000000Z"\n +"updated_at": "2022-01-19T08:29:05.000000Z"\n +"deleted_at": null\n +"tour_attendees": array:2 [\xe2\x96\xbc // array data that I want to extract \n 0 => {#3077 \xe2\x96\xb6} // attendee #1\n 1 => {#3054 \xe2\x96\xb6} // attendee #2\n ]\n }\nRun Code Online (Sandbox Code Playgroud)\n我想提取数据并放入表中,如下所示。
\n| No | Attendee #1 | Mobile | Attendee #2 | Mobile |\n| | …Run Code Online (Sandbox Code Playgroud) 有没有办法在laravel 8中定义路由组的名称?
我正在尝试为卖家建立前往订单管理网站的路线,下面是我在web.php 中的路线列表
use App\Http\Controllers\Seller\OrderController;
Route::group(['prefix' => 'seller', 'middleware' => 'auth', 'as' => 'seller.', 'namespace' => 'Seller'], function () {
Route::redirect('/','seller/orders');
Route::resource('/orders', [OrderController::class]);
});
Run Code Online (Sandbox Code Playgroud)
错误
ErrorException
Array to string conversion
at C:\wamp64\www\my-project\vendor\laravel\framework\src\Illuminate\Routing\ResourceRegistrar.php:416
412? protected function getResourceAction($resource, $controller, $method, $options)
413? {
414? $name = $this->getResourceRouteName($resource, $method, $options);
415?
? 416? $action = ['as' => $name, 'uses' => $controller.'@'.$method];
417?
418? if (isset($options['middleware'])) {
419? $action['middleware'] = $options['middleware'];
420? }
1 C:\wamp64\www\my-project\vendor\laravel\framework\src\Illuminate\Routing\ResourceRegistrar.php:416
Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Array to string conversion", "C:\wamp64\www\my-project\vendor\laravel\framework\src\Illuminate\Routing\ResourceRegistrar.php", ["orders", …Run Code Online (Sandbox Code Playgroud)