Category : laravel-blade

im trying to get the latest data on database, im using this on my views : @foreach ($shows as $s) <tbody> <tr> <th scope="row">{{$loop->iteration}}</th> <td>{{$s->nama}}</td> <td>{{$s->umur}}</td> <td>{{$s->alamat}}</td> <td>{{$s->nama_ortu}}</td> <td>{{$s->posyandu}}</td> <td>{{$s->result}}</td> </tr> </tbody> @endforeach and on controller : public function showresultpasien() { $shows = DB::table(‘pasiens’)->orderBy(‘id’, ‘DESC’)->first(); return view(‘result’, compact(‘shows’)); } did i doin something wrong ? ..

Read more

I started a new laravel 8 project and installed the laravel breeze auth starter kit. After that i made an api endpoint and i want to validate the post request going to that endpoint so i wrote some code: $validation = Validator::make($request->all(), [ ‘project_name’ => ‘required’, ‘project_location’ => ‘required’, ‘project_tasks’ => ‘required’, ]); if ($validation->fails()) ..

Read more

I save plain HTML with variable in database, like this <div> <span>Nomor: <strong>{{ $pen->nomor_sertifikat ?? "" }}</strong></span> <span> Nilai: <strong>Rp{{ number_format($pen->nilai_pen,0,’,’,’.’)}} </strong> </span> </div> When I call data from database in laravel blade, {!! $data->content !!}, the result is like this Nomor: {{ $pen->nomor_sertifikat }} Nilai: Rp{{ number_format($pen->nilai_pen,0,’,’,’.’)}} the data inside {{ }} can’t render. ..

Read more

Lets say i have 2 blade files: code1.blade.php <script> function callMyFunction(){ //i do something } </script> code2.blade.php @include(‘code1′) <script> callMyFunction(); //vs code never recognizes this function when i press Ctrl + space </script> Laravel includes the file perfectly . Javascript runs the function correctly . But the problem is that vs code can’t recognize the ..

Read more

I am trying to trigger a livewire function from a wire:click in a datatables array. This system works fine but only for the first datatable page. Nothing is triggered in the 2nd page or higher. Here is my code : event.php : public function showEvent($eventId) { return redirect()->route(‘events.show’, [$eventId]); } event.blade.php : <table class="table align-items-center ..

Read more

I’m trying to return data with a pagination. When I’m returning the data as paginate() I receive an error: htmlspecialchars() expects parameter 1 to be string, array given My controller: $tickets = Ticket::where(‘company_id’, Auth::user()->company_id)->paginate(3); Blade: <table class="bg-white overflow-hidden table-auto w-full flex-row flex-no-wrap whitespace-nowrap"> <tr> <th></th> <th class="bg-white px-4 py-2">Updated at</th> <th class="bg-white px-4 py-2">Case Title</th> ..

Read more

I started to work on an existing project in Laravel, and I get the error Call to undefined function html() The blade is using {{ html()->email(’email’) ->class(‘form-control’) ->placeholder(__(‘validation.attributes.frontend.email’)) ->attribute(‘maxlength’,191) ->attribute(‘autocomplete’,’off’) ->required() ->autofocus() }} And I don’t know if a service provider must be required or something else. Thanks. Sourc..

Read more

I’m writing a custom Laravel Helper that generates the img HTML tag dynamically (I use this to generate the img srcset and size attributes, because I use a CDN). But when returning the generated string, double quotes are added around the attributes. Spaces in attribute values are also broken into smaller attributes. <img src="&quot;https://ik.imagekit.io/sdqrv2ex9bq/Rosa_de_Saron/cremacao_slide.jpg?ik-sdk-version=php-2.0.0&quot;srcset=&quot;https://ik.imagekit.io/sdqrv2ex9bq/Rosa_de_Saron/tr:w-768:/cremacao_slide.jpg?ik-sdk-version=php-2.0.0" 768w,https:="" ..

Read more

Into my edit.blade.php, i can display the value into my input like this for prepare my update: <div> <x-label for="name" value="name" /> <x-input id="name" name="name" :value="$user->name" /> <x-label for="email" value="email" /> <x-input id="email" value="email" :value="$user->email" /> </div> This works but that code not : <label name="name" id="name" class="bg-white text-gray-600 px-1">Name</label> <input name="name" id="name" {{ $user->name ..

Read more

I have an SVG logo in Laraver 7 blade file that looks like this: <div class="navbar-header"> <a href="{{URL::to(‘/’)}}" title="Home" class="navbar-brand "><img class="" src="{{asset(‘files/user/bwt_logo_left-white-(1).svg’)}}" alt="Home" /></a> <button id="mobile_nav_btn" type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target-custom="#navigation"> <span class="sr-only">Toggle navigation</span> <span class="fa fa-bars fa-lg"></span> </button> </div> The problem is that the logo is not clickable. The area around it is ..

Read more

I have an application where an user can change his name via a pop-up. This is the method that handles the name change: public function changeVorname(Request $request) { $this->validate($request, [ ‘vorname’ => ‘required|max:255′, ]); Portal::query()->where(’email’, $request->email)->update([‘vorname’ => $request->neuer_vorname]); return redirect()->back()->with(‘message’, ‘Vorname erfolgreich geƤndert’); } This is the blade file with the modal: <div class="w-1/2 mb-4 ..

Read more

I passing data to vue from blade template: window.data = @json([‘user’ => Auth::user()?->load(‘addresses’), ‘cart’ => Auth::check() ? Cart::getContent() : null]); then in vue component: computed: { addresses() { return window.data.user.addresses } } template: <template> <div class="container"> <div class="dropdown mr-4" v-if="addresses.length"> <span data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fas fa-map-marker-alt color-primary mr-2"></i> <span class="address-btn"> {{ addresses[0].address.street |truncate(20,’…’)}} <i ..

Read more

I’m trying to update status. if status is 0 then on click it must update it to 1. but if status is 1 on click it must update it to 0. my controller public function status(Course $course) { if ($course->status == 0) { $course->update([‘status’ => ‘1’]); return redirect(‘/profile’)->with(‘statusOn’, ‘status on!’); } else { $course->update([‘status’ => ..

Read more