Category : javascript

I’m inserting multiple data into the database. There is an error for my column report_by which is SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘report_by’ cannot be null (SQL: insert into ‘complaints’ (‘defect_id’, ‘image’, ‘description’, ‘report_by’) values (1, C:wamp64tmpphp8E2E.tmp, leak, ?)) Inside column report_by should be the id of the user by using Auth. users table ..

Read more

I have a question about the @push and @stack directives. My project has a parent view/layout named admin.blade.php and various child views, including one named datatable.blade.php. The second file is used to display a datatable with all users, and this datatable requires some JS script which is unique for this particular file (datatable.blade.php) and does ..

Read more

I am doing E2E tests with cypress. i have to count the number of rows in a table which are different from case to case. in normal javascript I just write this to get the number of total rows of the column document.getElementById(‘hometable’).getElementsByTagName("tr").length-1 unfortunately in cypress i get the following error: document.getElementById(‘hometable’).getElementsByTagName("tr").length-1 VM298:1 Uncaught TypeError: ..

Read more

Im following this YT tutorial, I followed the steps but it seems that the ExampleComponent does not show. The App.vue shows but not the route. Here are my code: app.js import Vue from ‘vue’; import router from ‘./router’; import App from ‘./components/App’; require(‘./bootstrap’); const app = new Vue({ el: ‘#app’, components: { App }, router, ..

Read more

Im following this YT tutorial, I followed the steps but it seems that the ExampleComponent does not show. The App.vue shows but not the route. Here are my code: app.js import Vue from ‘vue’; import router from ‘./router’; import App from ‘./components/App’; require(‘./bootstrap’); const app = new Vue({ el: ‘#app’, components: { App }, router, ..

Read more

I’ve made a Laravel SPA application with Vue and Laravel Sanctum, but every time I do a POST request with axios I get a 419 error code (CSRF code mismatch). My bootstrap.js window._ = require(‘lodash’); window.axios = require(‘axios’); window.axios.defaults.withCredentials = true; window.axios.defaults.headers.common = { ‘X-Requested-With’: ‘XMLHttpRequest’, ‘X-CSRF-TOKEN’: document.querySelector(‘meta[name="csrf-token"]’).getAttribute(‘content’), }; axios.get(‘/sanctum/csrf-cookie’).then(response => { console.log(response); axios.post(‘/api/auth/login’, this.fields).then(response ..

Read more

I have a javascript section on my blade page: @section(‘javascript’) <script> $(function() { $(‘#table’).DataTable({ processing: true, serverSide: true, ajax: ‘{{ url(‘index’) }}’, columns: [ { data: ‘name’, name: ‘name’ }, { data: ‘code’, name: ‘code’ }, { data: ‘currencyCode’, name: ‘currencyCode’ }, { data: ‘vat_rate’, name: ‘vat_rate’ }, { data: ‘action’, name: ‘action’ } ], ..

Read more

First, sorry for the bad english and bad explanation, i already write ajaxsetup in script $.ajaxSetup({ headers: { ‘X-CSRF-TOKEN’: $(‘meta[name="csrf-token"]’).attr(‘content’) } }); and also the meta tag in the head meta name="csrf-token" content="{{ csrf_token() }}" but why the mdata below need _token that contain token to make it run var token = $(‘meta[name="csrf-token"]’).attr(‘content’); var mData={ ..

Read more

my code What I want My query in my controller public function show($id) { $structural = DB::table(‘attendance’)->where(‘payroll_daily_id’,$id) ->where(‘assignment’,’STRUCTURAL’) ->select(‘payroll_daily_attendance.*’) ->get(); $fetch = []; foreach($structural as $key){ if(!isset($fetch[$key->wrk_id][‘total_ot’]) && !isset($fetch[$key->wrk_id][‘total_days’]) ){ $fetch[$key->wrk_id][‘total_ot’] = 0; $fetch[$key->wrk_id][‘total_days’] = 0; } $fetch[$key->wrk_id][‘wrk_id’] = $key->wrk_id; $fetch[$key->wrk_id][‘daily_rate’] = $key->rate; $fetch[$key->wrk_id][‘date’][$key->date][‘work_hours’] = $key->reg_hour; $fetch[$key->wrk_id][‘date’][$key->date][‘adj_hour’] = $key->adj_hour; $fetch[$key->wrk_id][‘total_ot’] += $key->ot_adj; $fetch[$key->wrk_id][‘total_days’] += $key->reg_hour; ..

Read more

I am trying to use bootstrap collapse (https://getbootstrap.com/docs/4.1/components/collapse/) in v-for div… My question is: How to open just one div that was clicked, not all divs? (Problem is that when I click one button, all the divs are opening, so I tried v-bind:id="status.id", but something is not good…) My code is here: <template> <div class="container ..

Read more

I have an HTML form that I currently submit using the form action attribute and a php script. The post request is successful, but it reloads the page, and I want to avoid that. The project uses Laravel/Blade PHP templates. <form id="update-form" method="post" action="{{ route(‘update’, [‘id’ => $user[‘id’]]) }}" > @csrf … </form> <button type="submit" ..

Read more

I get an error "htmlspecialchars () expects parameter 1 to be string, array given". I am passing an array from the controller to the view and trying to collect it in a javascript function, Thank you very much for your help. Code controller $etis = EtiquetaPresupuesto::where(‘presupuestos_id’, $id)->get(); $idEtiquetas=[]; foreach ($etis as $eti) { array_push($idEtiquetas, $eti->etiquetas_id); ..

Read more

I get 419 error unknown status and csrf token mismatch, when I try to login in Laravel nova web app through chrome extension. I try to made exception verify csrf token for chrome extensions. Is it possible login in that approach or should I use Laravel passport auth? popup.js const url = ‘http://local.requestmapper.com/api/user/’; window.onload = ..

Read more

I’m sending this data to the view part that is written in view but isn’t displayed, do you think? $itemsCount = DB::table(‘items’) ->groupBy(‘level_id’) ->selectRaw(‘level_id, count(*) as type’); $ItemsMdCount = DB::table(‘items’) ->groupBy(‘project_model_id’) ->selectRaw(‘project_model_id, count(*) as type’); return view(‘project.view’, compact(‘users’, ‘itemsCount’, ‘itemsMdCount’)); And in vue I make the display {{ itemsCount }} How can I send the ..

Read more