Category : laravel-blade

I have a form with dynamically generated fields. I validated them. I want to display the error messages. protected $rules = [ ‘orderLines.*.item_id’ => ‘required|exists:items,id’ ] Validation works fine. I get error messages which I am able to show as follows: @error(‘orderLines.*.item_id’) <span class="text-red-600 text-sm" role="alert">{{ $message }}</span> @enderror Asterisk displays errors for item_id of ..

Read more

I am adding a textarea to my blade template and populating it with a read-only list of items server-side. This is what I got: <div class="form-group"> <textarea class="form-control" rows="10" readonly> @foreach($items as $item) {{trim($item)}} @endforeach </textarea> </div> My problem is it is not displaying correctly, I get lots of whitespace before each line. so it ..

Read more

I have this in my controller, but it keeps comes our below error in my edit.blade ErrorException Undefined variable: category (View: namespace AppHttpControllers; use AppModelsCategory; use IlluminateHttpRequest; class CategoryController extends Controller { /** * Display a listing of the resource. * * @return IlluminateHttpResponse * */ public function __construct() { } public function index() { ..

Read more

Hello I have a form like the below image- The HTML code for this is- <table style="width:100%" class="table table-striped"> <tr> <td><strong>First Name</strong></td> <td>Test Name</td> <td><a class="btn btn-success" href="#">Edit</a></td> </tr> <tr> <td><strong>Last Name</strong></td> <td>Test Name</td> <td><a class="btn btn-success" href="#">Edit</a></td> </tr> <tr> <td><strong>Username</strong></td> <td>test_username</td> <td><a class="btn btn-success" href="#">Edit</a></td> </tr> </table> Now what I am trying here is ..

Read more

i have 2 table that they have one to many relation and i want to get all client information and name user in blade it is user model public function FirstClients(){ return $this->hasMany("AppModelsFirstClient"); } it is client model public function User(){ return $this->belongsTo(‘AppModelsUser’); } it is controller $allclients= DB::table(‘first_clients’)->get(); return view(‘admin.client.allclients’ , compact(‘allclients’)); and this ..

Read more

Im trying to pass a prop from the root vue instance into the vue components which are located within a blade template file. Blade Template File: @extends(‘layouts.master’) @section(‘content’) <header-0 on-window-load="{{ onPageLoad }}"><header-0> <header-search-modal></header-search-modal> <side-nav></side-nav> @endsection JavaScript root Vue instance: var ComponentHeader = require(‘./components/Header.vue’).default; var ComponentHeaderSearchModal = require(‘./components/SearchModal.vue’).default; var ComponentSideNav = require(‘./components/SideNav.vue’).default; const app = new ..

Read more

I am using Laraval custom components, for example, I have: components/input.blade.php <input type="text" class="rounded"> Note: this is a simple example, the key part here is that I want to reuse the HTML generated by the blade template. Now I can create a Vue component with a scoped slot: js/components/Search.vue <template> <div> <slot name="search-input" /> </div> ..

Read more

I’m working with push and stacks in my views, in one of my views I need to change the tittle of the page, this is the view @extends(‘layouts.app_site’) @push(‘styles’) @endpush and this is the tag into layouts.app_site <title>{{empty($site) ? config(‘app.name_site_generator’, ‘Laravel’) : $site->meta_name}}</title> I want to delete the tag and replace in my view with ..

Read more

I’m working on an offline view for PWA applications, this is my view when I access the offline mode with connection: and this is my serviceworker javascript for cache the offline view is cached but bootstrap styles are not loaded. var staticCacheName = "pwa-v" + new Date().getTime(); var filesToCache = [ ‘/offline’, ‘/css/app.css’, ‘/js/app.js’, // ..

Read more

Error htmlspecialchars() expects parameter 1 to be string, array given (View: D:CodesPhpLaravelappoint_now-master1resourcesviewsstaffscheduleedit.blade.php) blade code <form action="{{route(‘staff.schedule.AddHour’,$day->id)}}" method="post" id="formHours-{{ $day->id }}" > @csrf @method(‘put’) <input type="hidden" value="{{$day->id}}" name="staff_schedule_day_id" required> </form> controller code public function addHour(Request $request,$staffSchedule) { $user = auth()->guard(GuardType::STAFF)->user(); $request->validate([ ‘staff_schedule_day_id’ => ‘required’, ‘start_time’ => ‘required’, ‘end_time’ => ‘required’, ]); $staffSchedulesDaysHours=new StaffScheduleDayHour(); $staffSchedulesDaysHours->staff_schedule_day_id = $request->staff_schedule_day_id; ..

Read more

I am saving this array in my database: $voz = array(); $datos = array(); $posicion_movil = array(); for ($i = 0; $i <= (int)$total_data["general_total_movil"]-1; $i++) { array_push($posicion_movil, $i); array_push($voz, "ilimitado"); array_push($datos, $data["movil_datos_datos-nacional"][$i]); } $movil = array( "posicion" => $posicion_movil, "voz" => $voz, "datos" => $datos ); $mi_resumen = new MyTariffResume(); $mi_resumen->movil = json_encode($movil, JSON_FORCE_OBJECT); $mi_resumen->save(); ..

Read more