Category : laravel-blade

I am trying to display the error div below a certain field if the validation for that input failed along with the previous input on the designated field. Here’s my progress so far: in my controller file inside the store function (UserController > store): public function store(Request $request) { $validationRules = array( ‘first_name’ => ‘required|min:2|max:150’, ..

Read more

Let me explain the requirements i would like to filter or search about student information then convert the information in PDF how to do it ? below are the codes public function filter(Request $request) { $student_name=$request->sname; $address=$request->address; $roll_number=$request->rollnumber; if($request->has(‘student_name’) && !empty($request->input(‘student_name’))||$request->has(‘address’) && !empty($request->input(‘address’))||$request->has(‘roll_number’) && !empty($request->input(‘roll_number’))) $students=Student::where(‘student_name’,$student_name) ->orWhere(‘address’,$address) ->orWhere(‘roll_number’,$roll_number) ->get(); else $students=Student::all(); // dd($schools); return view(‘reports/filterstudents’)->with([‘students’=>$students]); ..

Read more

how to display the following rows and columns in a foreach? here’s my code public function index() { $users = User::with(‘absen’)->get(); $period = CarbonPeriod::create(‘2020-11-25′,’2020-11-30’); return view(‘absen.index’,compact(‘users’,’period’)); } –controller– <div class="box-body"> <table class="table table-bordered"> <thead> <tr> <th>tanggal</th> <th>nama</th> <th>masuk</th> <th>keluar</th> </tr> </thead> <tbody> @foreach($period as $date) @foreach ($users as $user) <tr> <td>{{$date->format(‘Y-m-d’)}}</td> <td>{{ $user->nama}}</td> @foreach ($user->absen ..

Read more

I’m trying to dump a .php file created from a blade template into the public folder, this way: $html = view(‘input_file’, [ ‘variable’ => ‘text’ ]); File::put(public_path(‘output_file.php’), $html); where my input_file.blade.php is: <!DOCTYPE html> <html> <body> <div>{{ $variable }}</div> <div><?php echo mt_rand(); ?></div> </body> </html> What I want to achieve is to have output_file.php like ..

Read more

I would like to pass the two variables between two functions in one controller here is my code Web.php file Route::get(‘reports/export’,’[email protected]’)->name(‘exportPDF’); Route::post(‘reports/viewFilter’,’[email protected]’)->name(‘viewFilter’); here is the controller both functions public function viewFilter(Request $request) { $camp_id=$request->camp_id; $school_level=$request->school_level; $school_shift=$request->school_shift; $school_type=$request->school_type; if($request->has(‘camp_id’) && !empty($request->input(‘camp_id’))||$request->has(‘school_level’) && !empty($request->input(‘school_level’))||$request->has(‘school_type’) && !empty($request->input(‘school_type’))||$request->has(‘school_shift’) && !empty($request->input(‘school_shift’))) $schools=School::where(‘camp_id’,$camp_id) ->orWhere(‘school_level’,$school_level) ->orWhere(‘school_type’,$school_type) ->orWhere(‘school_shift’,$school_shift) ->get(); else $schools=School::where(‘school_active’,’Active’); // Here ..

Read more

This is probably something simple, but it’s doing my head in. So, my layout blade template has this: @include(‘layouts.partials.sidebar’) {{ $slot }} @include(‘layouts.partials.footer’) @include(‘layouts.partials.scripts’) I create a view which loads a template. This I assume gets parsed in $slot. return view(‘request’, [ ‘boo’ => ‘Hoo’ ]); No problems, the page loads and the variable ‘boo’ ..

Read more

I have a small problem with Laravel: This is my web.php Route::get(‘contakt/{code?}’, function ($code = "null") { return view(‘contakt’,compact(‘code’)); })->name("contakt"); And this is my Page: @if (strcmp($code,"success")) <div class="contact-form-success alert alert-success d-none mt-4" id="contactSuccess"> <strong>Success!</strong> </div> @endif When i var_dump out on the contact page the content of $code this is the result: …/storage/framework/views/8ebd5bc41eecbc72e9a5480450fe96d3ba115d33.php:81:string ‘success’ ..

Read more

I need to use pagination on a laravel blade, but from the controller comes another variable that does not pass pagination, how can I solve it? <div class="main-content"> <div class="breadcrumb"> <h1>Página de Cliente</h1> </div> <div class="separator-breadcrumb border-top"></div> <div class="card user-profile o-hidden mb-4"> <div class="user-info"><img class="profile-picture avatar-lg mb-2" alt="" /> <p class="m-0 text-24">{{ $customer->name }}</p> <p ..

Read more

I want to display the selected item of Select tag in p tag and when i run the code it doesn’t work, this is my code : <label for="modelResp"> Response </label> <select name="modelResp" id="modelResp" onchange="myFunction()"> @foreach ($destins as $dest) <option value="{{$dest->design_destin}}"> {{$dest->design_destin}} </option> @endforeach </select> <p id="demo"> **I want to display the selected item here** ..

Read more

I have a problem making the files downloadable after unzipping. And show in blade table with name of file, size of file and download button. Name and size is done in foraach. Problem is how to make the file downloadable. Error: Cannot use object of type SymfonyComponentHttpFoundationBinaryFileReponse as Array in page.blade.php Firstly ZipArchive extension: $ziparchive ..

Read more

I have a weird problem with the syntax of laravel (version 7) {{ }}, whene i use php synthax like that: <?php echo $thread->lastReply->user->name; ?> i get my user displayed but with the blade syntax : {{$thread->lastReply->user->name}} i got this error: ErrorException Trying to get property ‘user’ of non-object where could the problem come from? ..

Read more

In a create post form i have store the data into database using implode function because data was in array $this->posts->optional_info = implode(" ",$input[‘optional_info’]); now In edit form i want the data stored in database should get checked by default in view so i am trying like <div class="row"> @foreach($customArray[‘optional’] as $key => $value) <div ..

Read more

so i stored array of images while created a form, but i store these in local public folder not in database. //controller public function store(Request $request) { if($request->hasFile(‘files’)) { foreach($request->file(‘files’) as $image) { $destinationPath = ‘public/uploads/’; $filename = $request->input(‘surf_date’).’_’.$request->input(‘user_id’).’_’.$image->getClientOriginalName(); $image->move($destinationPath, $filename); } } $data = $request->all(); $rules = array( ‘post_type’ => [‘required’], ‘user_id’ => [‘required’,’numeric’], ..

Read more

so i am working on share post kind of form,i am getting the image by input field <div class="videoImageUploader"> <div class="upload-btn-wrapper"> <button class="">click to upload</button> <input type="file" id="input_multifileSelect" name="files[]" accept=".png, .jpg, .jpeg" multiple /> <input type="hidden" id="imagebase64Multi" name="surf_image_array[]" accept=".png, .jpg, .jpeg" multiple /> </div> </div> this i had input field which maybe incorrect and also ..

Read more

i am getting the date in blade form from controller in format like 2020-11-24(y-m-d) and i want to use this in input field value property <div class="row"> <div class="col-md-4"> <label>Surf Date <span class="required">*</span></label> </div> <div class="col-md-8"> <div class="selectWrap pos-rel"> <input class="form-control" type="date" name="surf_date" id="datepicker" value="{{ old(‘surf_date’),$posts->surf_start_date }}" required /> </div> </div> </div> but it does ..

Read more

In jetstream profile managing scaffolding in @if statements $this->enabled is used. And I can’t understand to what particular object does it refers? The file I am looking at "resourcesviewsprofiletwo-factor-authentication-form.blade.php": @if ($this->enabled) {{ __(‘You have enabled two factor authentication.’) }} @else {{ __(‘You have not enabled two factor authentication.’) }} @endif Stackoverflow system does not allow ..

Read more

I have a login.blade.php which holds: @extends(‘layouts.app’) @section(‘title’,’Login’) @section(‘form’) <div class="content"> <div class="text">Login Form</div> <form action="#"> <div class="field"> <span class="fas fa-user"></span> <input type="text" required> <label>Email or Phone</label> </div> <div class="field"> <span class="fas fa-lock"></span> <input type="password"> <label>Password</label> </div> <div class="forgot-pass"><a href="#">Forgot Password?</a></div> <button>Sign in</button> <div class="signup">Not a member? <a href="#">signup now</a> </div> </form> </div> @endsection And ..

Read more