laravel-6.2

Laravel 6 pathinfo() expects parameter 1 to be string, object given

好久不见. 提交于 2021-01-29 08:44:33
问题 This is where i get the error: $data = Excel::import($path, function($reader) {})->get(); I changed the load() to import() . I want to run this code in Laravel 6, but version 3 of MaatWebsiteExcel does not support load() . I've been searching for solutions, yet i cant find any.... This is my controller: namespace App\Http\Controllers; use App\Contact; use App\CsvData; use App\Http\Requests\CsvImportRequest; use Illuminate\Http\Request; use Maatwebsite\Excel\Facades\Excel; use Session; use DB;

Resource response is not wrapped with “data” [duplicate]

瘦欲@ 提交于 2021-01-28 11:31:10
问题 This question already has an answer here : Laravel paginate resources won't add meta (1 answer) Closed 12 months ago . I am very curious, why my resource response is not wrapped in data : This is my resource: App\Http\Resources\CategoryResource Object ( [resource] => stdClass Object ( [id] => 12 [title] => Category [description] => <p>Test</p> [with] => Array ( ) [additional] => Array ( ) ) Once this resource is returned like this: $response = $this->client->getApiResponse('/api/category/'.

npm run watch is not working in Laravel 6.0

放肆的年华 提交于 2020-08-26 09:55:07
问题 I am following this video https://www.youtube.com/watch?v=zEPYSNO7o3Q And I got error in npm run dev This is the solution I try: Step1: composer update Step2: rm -rf node_modules Step3: npm cache clean Step4: npm install Step5: npm outdated Step6: npm install Step7: npm run dev But I still get this error: > @ development C:\laragon\www\lara6 > cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules -- config=node_modules/laravel-mix/setup/webpack.config.js

1292 Incorrect datetime value for column 'updated_at'

我们两清 提交于 2020-06-15 04:13:48
问题 I've created a table in Laravel with standard datetime columns: Schema::create('lists', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name'); $table->string('ref'); $table->string('provider'); $table->timestamps(); $table->softDeletes(); $table->unique(['provider', 'ref']); }); When I try to do a simple record creation with Eloquent: List::updateOrCreate([ 'provider' => 'test', 'ref' => 'S4d3g' ], [ 'name' => 'Plan' ]); I am given this message (which is a raw

Registering vue components in Laravel package

南笙酒味 提交于 2020-03-23 08:00:12
问题 I have been trying very hard to register vue component in my own test package developed for laravel. I did even check laravel\horizon and some other packages but I can't figure out how to do it. I'm following Laravel Package Development so my package is outside my Laravel app. And my package structure is like below: vendor packagename resources js components examplecomponent.vue app.js AppServiceProvide.php package.json webpack.mix.js For the vue component it's just the Laravel's example, and

Laravel storage returns FileNotFoundException But file exists

久未见 提交于 2020-03-23 07:57:06
问题 I want read file content in laravel 6, the file already exists but laravel return not found exception. This is my logs files directory: /var/www/html/myLaravelLab/storage/logs/laravel-2019-10-14.log $contents = Storage::get(storage_path('logs/laravel-2019-10-14.log')); Laravel return this error: Illuminate\Contracts\Filesystem\FileNotFoundException But file already exists! I want read file contents. Laravel Version: 6.2.0 - PHP Version: 7.2.19 回答1: In config/filesystems.php add new disk logs

Understanding Php Traits Scope

时光怂恿深爱的人放手 提交于 2020-02-06 07:56:52
问题 I have The following files 1) A Class called Helper class Helper { public static function a(){ // } } 2) A Trait called SpecialTrait Trait SpecialTrait { public function b(){ Helper::a(); } } 3) A Controller Class Extending Controller called UserController use path\to\Helper; use path\to\SpecialTrait class UserController extends Controller { use SpecialTrait; public function c(){ $this->b(); } } When the program runs and function c() is called which is meant to call a trait function b() which

Laravel Auth, Getting the default URL that is passed in Notification

放肆的年华 提交于 2019-12-11 17:38:39
问题 I just wanted to change the ->greeting() in notification in my toMail() function of the default auth after registering. I want to retain the verify URL and etc. But I am stucked. If I override the sendEmailVerificationnotification() the whole mail is changed. How to get the URL that was supposed to be sent originally or how to edit the original auth to edit only the ->greeting('Hello') with Dear Name, ? In User Model public function sendEmailVerificationNotification() { $this->notify(new