laravel-5.6

captcha form validation required error message in vue-recaptcha

冷暖自知 提交于 2019-12-01 10:31:27
I am following this Package in vue.js and Laravel 5.6.7 to implement captcha. https://github.com/DanSnow/vue-recaptcha#install Component code in vue.js <template> <div> <vue-recaptcha v-model="loginForm.recaptcha" sitekey="My key"> </vue-recaptcha> <button type="button" class="btn btn-primary"> Login </button> </div> </template> <script> </script> app.js code import VueRecaptcha from 'vue-recaptcha'; Vue.use(VeeValidate); Vue.component('vue-recaptcha', VueRecaptcha); Question: Is there any property for vue-recaptcha called required which can be passed to show the form validation message? You

Laravel 5.6 Passport driver not working in socket.io and gives unauthorized exception

会有一股神秘感。 提交于 2019-12-01 07:36:26
问题 Below code was working perfectly when the driver was api. Then I created a new project and changed the driver to passport. Now, I am always getting Error: Unauthorized. I can confirm that the request header has authorization token code in the browser. Please check the below image by clicking it and click on zoom to see the image with better quality. Am I missing anything in below code? Please let me know if you need more info. bootstrap.js import Echo from 'laravel-echo' window.Echo = new

Laravel 5.6 getRouteKeyName() not working

…衆ロ難τιáo~ 提交于 2019-12-01 04:06:57
问题 This is the code I have so far: Web.php Route::get('/{uri}', 'PageController@show')->name('page.show'); PageController // Show the requested page public function show(Page $page) { return view('templates.page', compact('page')); } Page model public function getRouteKeyName() { return 'uri'; } My question is how come the Route-model-binding is not working and not finding the page in the controller even though I have changed the route key name. It just has an empty model in the controller and

How can I add title and sum value of column in laravel excel version 3?

一曲冷凌霜 提交于 2019-11-29 18:44:53
I get reference from here : https://laravel-excel.maatwebsite.nl/docs/3.0/getting-started/basics So I use version 3 My controller like this : public function exportToExcel(Request $request) { $data = $request->all(); $exporter = app()->makeWith(SummaryExport::class, compact('data')); return $exporter->download('Summary.xlsx'); } My script export to excel like this : namespace App\Exports; use App\Repositories\ItemRepository; use Maatwebsite\Excel\Concerns\FromCollection; use Maatwebsite\Excel\Concerns\Exportable; use Maatwebsite\Excel\Concerns\WithHeadings; class SummaryExport implements

How can I set text align right in the column on the laravel Excel maatwebsite?

允我心安 提交于 2019-11-29 18:19:13
I get reference from here : https://laravel-excel.maatwebsite.nl/3.0/getting-started/ I have been looking for how to set the text align right, but I did not find it in the documentation My script export like this : <?php namespace App\Exports; use Maatwebsite\Excel\Concerns\Exportable; use Illuminate\Contracts\View\View; use Maatwebsite\Excel\Concerns\FromView; class InvoiceExport implements FromView { use Exportable; public function view(): View { $data = Invoice::get(); return view('exports.item', [ 'data' => $data ]); } } How can I solve this problem? Update I find a solution, but it's not

How do I make automatic height row based on content in the maatwebsite version 3 laravel excel?

ぃ、小莉子 提交于 2019-11-29 18:09:37
I had search reference and the reference say to try like this : <?php ... class ReportExport implements ShouldAutoSize, FromView, WithColumnFormatting, WithEvents { ... public function registerEvents(): array { return [ AfterSheet::class => function(AfterSheet $event) { ... $event->sheet->getDelegate()->getRowDimension(37)->setRowHeight(-1); $event->sheet->getDelegate()->getStyle('R37:Z37')->getAlignment()->setWrapText(true); }, ]; } } I try like that, but the result like this : Should the height of row automatic added based content/text. But it does not added How can I solve this problem?

How to insert big data on the laravel?

情到浓时终转凉″ 提交于 2019-11-29 15:58:02
I am using laravel 5.6 My script to insert big data is like this : ... $insert_data = []; foreach ($json['value'] as $value) { $posting_date = Carbon::parse($value['Posting_Date']); $posting_date = $posting_date->format('Y-m-d'); $data = [ 'item_no' => $value['Item_No'], 'entry_no' => $value['Entry_No'], 'document_no' => $value['Document_No'], 'posting_date' => $posting_date, .... ]; $insert_data[] = $data; } \DB::table('items_details')->insert($insert_data); I have tried to insert 100 record with the script, it works. It successfully insert data But if I try to insert 50000 record with the

L5.6 - Relation on pivot table

♀尐吖头ヾ 提交于 2019-11-29 12:39:28
I've a relation on a pivot table; how I can expand It? For example: shops : id name products : id name product_shop : product_id shop_id field_1 field_2 field_3 table_A_id table_A : id name The relation Many-to-Many in the Shops Model is: class Shops extends Model { public function products() { return $this->belongsToMany('Products', 'product_shop', 'product_id', 'shop_id')->withPivot( 'field_1', 'field_3', 'field_3', 'table_A_id' ) ->as('product_shop') ->withTimestamps(); } } and the query to retrieve all data is: class GetData extends Model { public static function getAll() { $query = Shops:

How can I convert array two dimensional to collection laravel?

限于喜欢 提交于 2019-11-28 14:22:57
I have array like this : $test = array( array( 'name' => 'Christina', 'age' => '25' ), array( 'name' => 'Agis', 'age' => '22' ), array( 'name' => 'Agnes', 'age' => '30' ) ); I want to change it to collection laravel I try like this : collect($test) The results are not perfect. There is still an array How can I solve this problem? collect($test) does not convert $test to a collection, it returns $test as a collection. You need to use it's return value for a new variable, or override the existing one. $test = collect($test); If you want to convert the individual items to objects (instead of

How can I add title and sum value of column in laravel excel version 3?

社会主义新天地 提交于 2019-11-28 13:36:56
问题 I get reference from here : https://laravel-excel.maatwebsite.nl/docs/3.0/getting-started/basics So I use version 3 My controller like this : public function exportToExcel(Request $request) { $data = $request->all(); $exporter = app()->makeWith(SummaryExport::class, compact('data')); return $exporter->download('Summary.xlsx'); } My script export to excel like this : namespace App\Exports; use App\Repositories\ItemRepository; use Maatwebsite\Excel\Concerns\FromCollection; use Maatwebsite\Excel