Category : laravel-blade

Im making a multi-language website and i’m using laravel 8.0 to do it. My idea is that when the user selects the origin country, to change the language as well after he chooses it. This is the register.blade.php <div> <x-jet-label for="country_id" value="{{ __(‘register.Choose your country’)}}"/> <select id="country_id" name="country_id" class=’ w-full border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 ..

Read more

I’m making a multi-language website using Laravel 8. I have translated the words using {{ __(filexp.wordexp) }} and also having the lang/en file with the words translated. I have stuck at a function which uses {!! !!} function, and I want to translate the word inside the function. <x-jet-checkbox name="terms" id="terms"/> <div class="ml-2"> {!! __(‘By ..

Read more

This is a new-comer question. I have a Blade template: <div id="app"> <example-component :componentMessage="appMessage" ></example-component> </div> <script> var app = new Vue({ el: "#app", data: function() { return { appMessage: {{$message}} } } }) </script And a Vue component ExampleComponent.vue <template> <p>{{componentMessage}}</p> </template> <script> export default { props: [‘componentMessage’], } </script> So the data flow ..

Read more

How do I construct a laravel blade directive to show a number in money format with the currency symbol attached to it? I have tried using number_format() Blade::directive(‘money’, function ($value) { return "<?php echo config(‘app.currency’) . number_format($value, 2); ?>"; }); Is there a way to display the currency symbol, based on the app locale, to ..

Read more

I have defied a generic input component in Laravel like this: //file: views/components/input.balde.php <input @foreach ($attrs as $attr=>$val) {{ $attr }} = "{{ $val }}" @endforeach > And I would like to use it as follows in blade templates: <x-input :attrs="{{ [‘type’=>’text’, ‘placeholder’=>"Search.."] }}" ></x-input> the thing is when I pass an array object like ..

Read more

I have a form in Laravel Blade which contains data that need to be hidden and shown dynamically. Here is the code. @foreach ($working_orders as $key => $order) <div class="col-lg-12 row "> <div class="title-md">Work Order # {{$order->id}}</div> <div class="form-group col-lg-6"> <label style="color: #44484d;">Camión</label> <select class="form-control kt-selectpicker truck_type" required name="truck_type" onchange="getOrderFields()"> <option value="1" selected>No asignar</option> <option ..

Read more

I have a form in my blade with 3 inputs. User must at least fill one of the inputs, I mean each input is required if the others are empty. I don’t know how to write my validation rules in Laravel controller. The inputs: <div class="mt-3"> <x-label for="telegram" value="__(‘Telegram’)"/> <x-input type="text" name="telegram" class="mt-1 block w-full" ..

Read more

I have tried this code but it only worked once after that i have to refresh the page and then again it will work only once. `enter code here`<tr class="all"> <!–Guarito=Healed –> <th style="width:30vh" class="table-info">Guarito</th> @for($i=0;$i<4;$i++) <td> <input type="checkbox" name="Guarito-{{$i}}" id="Guarito-{{$i}}" class="selectall" @if(!empty($FollowupTreatment[$i] ->guarito) && $FollowupTreatment[$i] ->guarito == 1) checked @endif > </td> </tr> Here ..

Read more

if the only 2nd box is checked then the 3rd one and 4th one must be checked automatically. and if the only 3rd box is checked then the 4th one must be checked automatically. <tr class="all"> <!–Guarito–> <th style="width:30vh" class="table-info">Guarito/2</th> @for($i=0;$i<4;$i++) <td> <input type="checkbox" class="selectall" name="Guarito-{{$i}}" id="Guarito-{{$i}}" @if(!empty($FollowupTreatment[$i] ->guarito) && $FollowupTreatment[$i] ->guarito == 1) checked ..

Read more

Laravel: Possible typo $svg – Did you mean $svg? Well yes, yes I did! I’ve got a navbar-link component: @props([ ‘svg’, ‘route’, ]) <a href="{{ route($route) }}" class="w-full focus:text-teal-500 hover:text-teal-500 justify-center inline-block text-center pt-2 pb-1"> <div {{ $svg->attributes->class([‘inline-block’]) }}> {{ $svg }} </div> <span class="tab tab-home block text-xs">{{ $slot }}</span> </a> And I’m using it ..

Read more

Dears, I need to set the old value of the two same inputs in laravel blade. the first div works properly but the second one not working. <div class="form-group parent_id"> {{ Form::label(‘parent_id’, ‘اختر اللجنة الرئيسية’, [‘class’ => ‘control-label’]) }} {{ Form::select(‘parent_id’, $parents, Input::old(‘parent_id’) , [‘placeholder’ => ”,’class’ => ‘form-control parent_id select2d’]) }} <span class="text-danger">{{ $errors->first(‘parent_id’) ..

Read more

i trie to change title page use @section(‘page_title’, {{ $mapel->subjects_name }} ) but view error message syntax error, unexpected ‘<‘, expecting ‘)’ (View: /mnt/187621C87621A788/ProjekWeb/eLearning/resources/views/lesson/index.blade.php) in my controller public function show($id) { $mapel = Subjects::findOrFail($id); return view(‘lesson.index’, compact(‘mapel’)); } I’ve tried to check with dd($mapel->subjects_name) and the data comes out, thank u Sourc..

Read more

In my Laravel project, I have the following models: Product (‘name’ string, ‘amount’ integer and ‘price’ decimal) Cart (‘cost’ decimal) CartProd (‘unit_price’ decimal, ‘amount’ integer, ‘discount’ decimal, ‘total_cost’ decimal and foreign keys to a product and a cart) The idea is that, when you want to create a new cart, the CartController method creates a ..

Read more