laravel-5

add another array data in array php

♀尐吖头ヾ 提交于 2021-01-07 02:48:51
问题 hello i am trying to add another array data to an array, i have array like this, array:4 [▼ "data" => array:19 [▼ 0 => array:2 [▼ 0 => array:1 [▼ "filename" => "a" ] 1 => array:1 [▼ "filename" => "b" ] ] 1 => array:2 [▼ 0 => array:1 [▼ "filename" => "c" ] 1 => array:1 [▼ "filename" => "d" ] ] 2 => array:2 [▼ 0 => array:1 [▼ "filename" => "e" ] 1 => array:1 [▼ "filename" => "f" ] ] ] "video" => array:2 [▼ 0 => array:1 [▼ "url" => "x" ] 1 => array:1 [▼ "url" => "y" ] ] ] i want array like this

Laravel 8 Shopping Cart item quantity wont increment

北慕城南 提交于 2021-01-07 02:36:52
问题 new update: I have solved this problem, you can refer to this post for the answer. I'm a beginner in laravel and I've been trying to create a simple ecommerce web but i got stuck in this logic error for days. I've been following in a youtube tutorial about creating shopping cart but the item quantity won't increment if i add the same item in the cart. The totalPrice and totalQty seems counting fine though... this is what i get when i tried to dd($this) into cart.php. I think it's because i

how to use or import ffmpeg in a laravel controller

人走茶凉 提交于 2021-01-07 01:27:05
问题 i have already installed the laravel-ffmpeg via composer in my project composer require pbmedia/laravel-ffmpeg then i added class to config/app.php file as documentation says // config/app.php 'providers' => [ ... ProtoneMedia\LaravelFFMpeg\Support\ServiceProvider::class, ... ]; 'aliases' => [ ... 'FFMpeg' => ProtoneMedia\LaravelFFMpeg\Support\FFMpeg::class ... ]; then publish this config file php artisan vendor:publish --provider="ProtoneMedia\LaravelFFMpeg\Support\ServiceProvider" now my

Eloquent morphTo()->withTrashed() stopped working

坚强是说给别人听的谎言 提交于 2021-01-06 04:24:07
问题 I have a polymorphic relationship set up in an OrderItem model, where saleable can be a few different models. I've set it up like any other relationship: public function saleable() { return $this->morphTo()->withTrashed(); } This used to work fine, now all of a sudden it doesn't work and it throws the error: Call to undefined method Illuminate\Database\Query\Builder::withTrashed() I don't understand why it would have stopped working, possibly due to a composer update which may have updated

How can I mock external API during testing in laravel 5?

大城市里の小女人 提交于 2021-01-05 12:27:59
问题 I want to test an HTTP route in laravel. The action function of the URL calls a helper function, which calls an external API. How can I mock the external API call while testing? public function actionFunction(){ $helper = new HelperClassHelper(); return Response::json($helper->getNames()); } Here, the getNames() function makes an external API call. How do I mock it? 回答1: You can add the HelperClassHelper as a dependency in the action, and then you are able to mock it in the test: public

How can I mock external API during testing in laravel 5?

烈酒焚心 提交于 2021-01-05 12:27:35
问题 I want to test an HTTP route in laravel. The action function of the URL calls a helper function, which calls an external API. How can I mock the external API call while testing? public function actionFunction(){ $helper = new HelperClassHelper(); return Response::json($helper->getNames()); } Here, the getNames() function makes an external API call. How do I mock it? 回答1: You can add the HelperClassHelper as a dependency in the action, and then you are able to mock it in the test: public

How can I mock external API during testing in laravel 5?

眉间皱痕 提交于 2021-01-05 12:21:44
问题 I want to test an HTTP route in laravel. The action function of the URL calls a helper function, which calls an external API. How can I mock the external API call while testing? public function actionFunction(){ $helper = new HelperClassHelper(); return Response::json($helper->getNames()); } Here, the getNames() function makes an external API call. How do I mock it? 回答1: You can add the HelperClassHelper as a dependency in the action, and then you are able to mock it in the test: public

Laravel 5.5 Axios POST results in 419 error

被刻印的时光 ゝ 提交于 2021-01-02 08:43:13
问题 I am trying to make a POST-request to my Laravel API from Vue. The X-CSRF-TOKEN header is set correctly (I see this in the POST-package sent to the server). The route has the default web -middleware. Request Accept:application/json, text/plain, */* Accept-Encoding:gzip, deflate Accept-Language:de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7 Connection:keep-alive Content-Length:2 Content-Type:application/json;charset=UTF-8 Host:api.xxx.local Origin:http://manager.xxx.local Referer:http://manager.xxx.local

Laravel 5.5 Axios POST results in 419 error

痴心易碎 提交于 2021-01-02 08:43:07
问题 I am trying to make a POST-request to my Laravel API from Vue. The X-CSRF-TOKEN header is set correctly (I see this in the POST-package sent to the server). The route has the default web -middleware. Request Accept:application/json, text/plain, */* Accept-Encoding:gzip, deflate Accept-Language:de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7 Connection:keep-alive Content-Length:2 Content-Type:application/json;charset=UTF-8 Host:api.xxx.local Origin:http://manager.xxx.local Referer:http://manager.xxx.local

Laravel Artisan: How does `schedule:run` work?

两盒软妹~` 提交于 2021-01-02 05:30:29
问题 I have a dummy Command job set up, whose handle() function is as follows: public function handle() { $this->line('=================='); $this->line('Running my job at ' . Carbon::now()); $this->line('Ending my job at ' . Carbon::now()); } As you see, it doesn't actually do anything but return a few lines of info to the standard output. Now, in my App\Console\Kernel class, I have set up the following schedule: protected function schedule(Schedule $schedule) { $schedule -> command('cbh