Laravel web app displaying incorrect database entries - php

I am trying to troubleshoot a web app that is not functioning 100% correctly that was built by a former employee. I have a novice understanding of PHP.
This is a relatively simple app that displays past exam files, but is locked down to the public. It is working correctly for the most part except for a weird thing happening with sample answer files. Not every exam has a sample answer file. The ones that don't have one should just be blank. However what is happening is that some exam files that do not have a corresponding answer file are displaying the button for exam files for other exams.
You can see from this image, that the first exam from Spring 1997 shows a blank space for sample answer which is correct. the next three exams are also correct in that they are showing the correct answer file, however, the last three exams do not actually have sample answer files in the database but are showing the sample answer for Spring 2004, like they are repeating the last file name that is in a specific sequence.
What I think is happening is that there is nothing in the code specifically saying to render a blank space if there is no corresponding answer file, but I don't know if this is actually the case. This is the code from index.blade.php:
<div class="row">
<h4>Browse past exams</h4>
<form class="form-inline">
<div class="form-group">
<label class="col-sm-2">Course</label>
<div class="col-sm-4">
{{ Form::select('course', $courses, Input::get('course', ''), array('class' => 'form-control')) }}
</div>
</div>
<div class="form-group">
<label class="col-sm-2">Faculty</label>
<div class="col-sm-4">
{{ Form::select('faculty', $faculties, Input::get('faculty', ''), array('class' => 'form-control')) }}
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
{{ Form::submit('Submit', array('class' => 'btn btn-primary')) }}
</div>
</div>
{{ Form::close() }}
</form>
#if(PastExamsPublicController::isAdmin())
<div class="col-md-10 col-md-offset-1" style="margin-top: 25px; margin-bottom: 25px;">
<div class="btn-group" role="group">
<a href="{{ route('past-exams.utlaw.admin.exams.create') }}" class="btn btn-primary">
Add exam
</a>
<a href="{{ route('past-exams.utlaw.admin.faculty.index') }}" class="btn btn-primary">
Manage faculty
</a>
<a href="{{ route('past-exams.utlaw.admin.course.index') }}" class="btn btn-primary">
Manage courses
</a>
</div>
</div>
#endif
<hr>
</div>
<div class="row">
<div class="col-md-10 col-md-offset-1 col-xs-12">
<table class="table table-hover" id="past-exams-table" class="sort">
<thead>
<tr>
<th class='sort-default'>Course</th>
<th>Session/year</th>
<th>Faculty</th>
<th class='no-sort'>Exam</th>
<th class='no-sort'>Sample Answers</th>
</tr>
</thead>
<tbody>
#foreach($exams as $exam)
<tr>
<td>{{ $exam->course->name }}</td>
<td data-sort="{{ $exam->year . $exam->session->name }}" >
{{ $exam->session->name . '/' . $exam->year }}
</td>
<td>{{ $exam->faculty->last_name . ', ' . $exam->faculty->first_name }}</td>
<?php
foreach($exam->files as $file) {
if($file->type == 'a') {
$answers = $file->filename;
}
else{
$examf = $file->filename;
}
}
?>
<td>
<a href="{{ asset('files/' . $examf) }}" class="btn btn-warning">
<span class="glyphicon glyphicon-download" aria-hidden="true"></span> Exam
</a>
</td>
<td>
#if(isset($answers))
<a href="{{ asset('files/' . $answers) }}" class="btn btn-primary">
<span class="glyphicon glyphicon-download" aria-hidden="true"></span> Sample Answers
</a>
#endif
</td>
</tr>
#endforeach
</tbody>
</table>
</div>
</div>
Thank you in advance for any guidance in helping point me to the genesis of the error.

Your problem exists here:
foreach($exam->files as $file) {
if($file->type == 'a') {
$answers = $file->filename;
}
else{
$examf = $file->filename;
}
}
This is contained inside a foreach loop so gets run for each exam. If the exam type is "a", the $answers variable gets set, but there is nothing that clears it if it is not set. Would recommend initializing it to null before the loop:
$answers = null;
$examf = null;
foreach($exam->files as $file) {
if($file->type == 'a') {
$answers = $file->filename;
}
else{
$examf = $file->filename;
}
}
EDIT: As pointed out by #mopo922, you will want to do the same with $examf, which I added above.

Related

Error with my controller and ajax function

I used AJAX to create live search function, but I have meet the error on my controller. I think it's syntax error on the last td #method('DELETE'), I don't know how to fix it, can anyone help me ?
public function search(Request $request)
{
$output = '';
$users = User::where('name','LIKE','%'.$request->keyword.'%')->get();
foreach($users as $user)
{
$output += '<tr>
<td>
<div class="d-flex px-2 py-1">
<div>
<img src="'. asset('storage/users/' . $user->image) .'"
class="avatar avatar-sm me-3 border-radius-lg" alt="user1">
</div>
<div class="d-flex flex-column justify-content-center">
<h6 class="mb-0 text-sm">{{ $user->name }}</h6>
<p class="text-xs text-secondary mb-0">'. $user->email .'</p>
</div>
</div>
</td>
<td>
<p class="text-xs font-weight-bold mb-0">'. $user->date_of_birth .'</p>
<p class="text-xs text-secondary mb-0">'. $user->phone .'</p>
</td>
<td class="align-middle text-center">
<span
class="text-secondary text-xs font-weight-bold">'. $user->address .'</span>
</td>
<td class="align-middle">
<form action="" method="POST">
{{ csrf_field() }}
#method('DELETE')
<button class="btn btn-danger" data-toggle="tooltip"
data-original-title="Delete user" type="submit">Delete</button>
</form>
</td>
</tr>';
}
return response()->json($output);
}
One clean solution to achieve what you need is to render the HTML as blade file using view('')->render() instead of building it on the controller
Create a new view file at resources/views/partials/user-search.blade.php and move your HTML to it
#foreach ($users as $user)
<tr>
<td>
<div class="d-flex px-2 py-1">
<div>
<img src="{{ asset('storage/users/'.$user->image) }}"
class="avatar avatar-sm me-3 border-radius-lg" alt="user1">
</div>
<div class="d-flex flex-column justify-content-center">
<h6 class="mb-0 text-sm">{{ $user->name }}</h6>
<p class="text-xs text-secondary mb-0">{{ $user->email }}</p>
</div>
</div>
</td>
<td>
<p class="text-xs font-weight-bold mb-0">{{ $user->date_of_birth }}</p>
<p class="text-xs text-secondary mb-0">{{ $user->phone }}</p>
</td>
<td class="align-middle text-center">
<span class="text-secondary text-xs font-weight-bold">{{ $user->address }}</span>
</td>
<td class="align-middle">
<form action="" method="POST">
{{ csrf_field() }}
#method('DELETE')
<button class="btn btn-danger" data-toggle="tooltip"
data-original-title="Delete user" type="submit">Delete</button>
</form>
</td>
</tr>
#endforeach
then modify your Controller search method to something like:
public function search(Request $request)
{
$users = User::where('name', 'LIKE', '%'.$request->keyword.'%')->get();
$output = view('partials.user-search')->with(['users' => $users])->render();
return response()->json($output);
}
Before I propose my fixes note that #ferhsom solution is a really a cleaner and better way to achieve what you need. But still the error in your code need to be pin pointed.
Errors
First the litteral string
Everything written between single quotes is considered as a string (literally) so no function call or variable will work.
The following string as HTML will give you this: enter image description here:
'
<td>
<form action="" method="POST">
{{ csrf_field() }}
#method("DELETE")
<button type="submit">Delete</button>
</form>
</td>
'
But what you need is hidden inputs with the keys _method and _token.
Second no Blade rendering
#method and #csrf are a Blade directives which will not make any sense if it doesn't pass through the rendering process.
Solution
Replace #method('DELETE') with:
'<input type="hidden" name="_method" value="DELETE">'
For #csrf or {{ csrf_field() }} do:
'<input type="hidden" name="_token" value="' . csrf_token() . '">'
Or
'' . csrf_field() . ''

How to show data of current logged user in laravel

I have three tables. First is user which has an 'email' as a username. Second is customer which alos has email column. And third table is shipments. The shipment has relationship with customer table. User can login with email id which is present in User and Customer table. When user is logged in with their email I wamt to show shipments related to respective user, filterdered by email address of current logged in user. Please guide be. below is my index.blade.php
#extends('layouts.app')
#section('content')
<div class="page-titles">
<h2> Vishal {{ $pageTitle }} <small> {{ $pageNote }} </small></h2>
<h4></h4>
</div>
<div class="card">
<div class="card-body">
<div class="toolbar-nav" >
<div class="row">
<div class="col-md-4 col-4">
<div class="input-group ">
<input type="text" class="form-control form-control-sm onsearch" data-target="{{ url($pageModule) }}" aria-label="..." placeholder=" Type And Hit Enter ">
</div>
</div>
<div class="col-md-8 col-8 text-right">
<div class="btn-group">
#if($access['is_add'] ==1)
<a href="{{ url('shipments/create?return='.$return) }}" class="btn btn-sm btn-primary"
title="{{ __('core.btn_create') }}"><i class="fas fa-plus"></i> {{ __('core.btn_create') }}</a>
#endif
<div class="btn-group">
<button type="button" class="btn btn-sm btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fas fa-bars"></i> Bulk Action </button>
<ul class="dropdown-menu">
#if($access['is_remove'] ==1)
<li class="nav-item"><a href="javascript://ajax" onclick="SximoDelete();" class="nav-link tips" title="{{ __('core.btn_remove') }}">
Remove Selected </a></li>
#endif
#if($access['is_add'] ==1)
<li class="nav-item"><a href="javascript://ajax" class=" copy nav-link " title="Copy" > Copy selected</a></li>
<div class="dropdown-divider"></div>
<li class="nav-item"> Import CSV</li>
#endif
<div class="dropdown-divider"></div>
#if($access['is_excel'] ==1)
<li class="nav-item"> Export Excel </li>
#endif
#if($access['is_csv'] ==1)
<li class="nav-item"> Export CSV </li>
#endif
#if($access['is_pdf'] ==1)
<li class="nav-item"> Export PDF </li>
#endif
#if($access['is_print'] ==1)
<li class="nav-item"> Print Document </li>
#endif
<div class="dropdown-divider"></div>
<li class="nav-item"> Clear Search </li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- Table Grid -->
{!! Form::open(array('url'=>'shipments?'.$return, 'class'=>'form-horizontal m-t' ,'id' =>'SximoTable' )) !!}
<div class="table-responsive">
<table class="table table-hover table-striped " id="{{ $pageModule }}Table">
<thead>
<tr>
<th style="width: 3% !important;" class="number"> No </th>
<th style="width: 3% !important;">
<input type="checkbox" class="checkall filled-in" id="checked-all" />
<label for="checked-all"></label>
</th>
#foreach ($tableGrid as $t)
#if($t['view'] =='1')
<?php $limited = isset($t['limited']) ? $t['limited'] :'';
if(SiteHelpers::filterColumn($limited ))
{
$addClass='class="tbl-sorting" ';
if($insort ==$t['field'])
{
$dir_order = ($inorder =='desc' ? 'sort-desc' : 'sort-asc');
$addClass='class="tbl-sorting '.$dir_order.'" ';
}
echo '<th align="'.$t['align'].'" '.$addClass.' width="'.$t['width'].'">'.\SiteHelpers::activeLang($t['label'],(isset($t['language'])? $t['language'] : array())).'</th>';
}
?>
#endif
#endforeach
<th style="width: 10% !important;">{{ __('core.btn_action') }}</th>
</tr>
</thead>
<tbody>
#foreach ($rowData as $row)
<tr>
<td class="thead"> {{ ++$i }} </td>
<td class="tcheckbox">
<input type="checkbox" class="ids filled-in" name="ids[]" value="{{ $row->id }}" id="val-{{ $row->id }}" />
<label for="val-{{ $row->id }}"></label>
</td>
#foreach ($tableGrid as $field)
#if($field['view'] =='1')
<?php $limited = isset($field['limited']) ? $field['limited'] :''; ?>
#if(SiteHelpers::filterColumn($limited ))
<?php $addClass= ($insort ==$field['field'] ? 'class="tbl-sorting-active" ' : ''); ?>
<td align="{{ $field['align'] }}" width=" {{ $field['width'] }}" {!! $addClass !!} >
{!! SiteHelpers::formatRows($row->{$field['field']},$field ,$row ) !!}
</td>
#endif
#endif
#endforeach
<td>
<div class="dropdown">
<button class="btn dropdown-toggle" type="button" data-toggle="dropdown"><i class="fas fa-tasks"></i> </button>
<ul class="dropdown-menu">
#if($access['is_detail'] ==1)
<li class="nav-item"> {{ __('core.btn_view') }} </li>
#endif
#if($access['is_edit'] ==1)
<li class="nav-item"> {{ __('core.btn_edit') }} </li>
#endif
<div class="dropdown-divider"></div>
#if($access['is_remove'] ==1)
<li class="nav-item"><a href="javascript://ajax" onclick="SximoDelete();" class="nav-link tips" title="{{ __('core.btn_remove') }}">
Remove Selected </a></li>
#endif
</ul>
</div>
</td>
</tr>
#endforeach
</tbody>
</table>
</div>
<input type="hidden" name="action_task" value="" />
{!! Form::close() !!}
<!-- End Table Grid -->
</div>
#include('footer')
</div>
</div>
<script>
$(document).ready(function(){
$('.copy').click(function() {
var total = $('input[class="ids"]:checkbox:checked').length;
if(confirm('are u sure Copy selected rows ?'))
{
$('input[name="action_task"]').val('copy');
$('#SximoTable').submit();// do the rest here
}
})
});
</script>
#stop
So you want to display shipments of a logged-in user? Then at this point, I'm expecting that you have already defined the Eloquent Relationships as methods on your Eloquent User and Shipment model classes and actually able to save the data.
In your Controller
use Illuminate\Support\Facades\Auth;
public function index()
{
$user = Auth::user()->load('shipments');
return view('sample.index', ['user' => $user]);
}
With the Auth::user() it checks if the current user is authenticated (returns true if the user is logged-in) via the Auth facade. Since the User model has already been retrieved, you can use Lazy Eager Loading with the load() to load the Shipment model.
And in your blade, you can display user's info and iterate over the shipment collection like so:
#foreach ($user->shipments as $shipment)
<p>{{ $shipment->field }}</p>
#endforeach

laravel 7 calling a method function for delete a file

i tried now long enough how i call the delete function from my mediacontroller in my media index.blade. I dont get it. So if someone of you give me a tipp please answer! I would really appreciate it!
Thats my media index.blade.php:
<div class="container">
<div class="row">
<div class="col-4">
<div class="card">
<div class="card-header">
<h3>Upload</h3>
</div>
<div class="card-body">
<form method="post" enctype="multipart/form-data" action="{{"upload"}}">
#csrf
<div class="input-group">
<div class="custom-file">
<input type="file" class="custom-file-input" id="media"
aria-describedby="media" name="file">
<label class="custom-file-label" for="media">Datei auswählen</label>
</div>
</div>
#error('file')
<div class="alert alert-danger">{{ $message }}</div>
#enderror
<hr/>
<button class="btn btn-success">Hochladen</button>
</form>
</div>
</div>
</div>
<div class="col-8">
<div class="card">
<div class="card-header">
<h1>Media</h1>
#if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
#endif
</div>
<div class="card-body">
<form action="{{route('media.index')}}" method="GET" role="search">
{{ csrf_field() }}
<div class="input-group">
<input type="text" class="form-control" name="q" value="{{request()->input("q")}}"
placeholder="Suche...">
<span class="input-group-btn">
<button type="submit" class="btn btn-light">
<span class="fa fa-search"></span>
</button>
</span>
</div>
</form>
<br/>
#if($medias->count() > 0 )
<table class="table table-bordered table-hover">
<thead>
<th>ID</th>
<th>Dateiname</th>
<th>Extension</th>
<th>Größe</th>
<th>Preview</th>
</thead>
<tbody>
#foreach($medias as $media)
<tr>
<td>{{$media->id}}</td>
<td>{{$media->name}}</td>
<td>{{$media->extension}}</td>
<td>{{$media->size}}</td>
<td><a href="{{route('media', $media->id)}}">
#if(in_array($media->extension, ["jpg", "jpeg", "bpm", "png", "gif"]))
<img src="{{route("media", $media->id)}}" width="150"/>
#else
#switch($media->extension)
#case("pdf")
<i class="fa fa-file-pdf"></i>
#break
#case("xsls")
<i class="fa fa-file-excel"></i>
#break
#case("doc")
<i class="fa fa-file-word"></i>
#break
#case("docx")
<i class="fa fa-file-word"></i>
#break
#case("svg")
<i class="fa fa-vector-square"></i>
#break
#endswitch
#endif
</a></td>
</td>
<td> <i class="fa fa-trash"></i>
</td>
</tr>
#endforeach
</tbody>
</table>
#else
<h4>Es wurden keine Daten gefunden</h4>
#endif
{{$medias->links()}}
</div>
</div>
</div>
</div>
</div>
now my web.php with the routes:
Route::resource("kitas", "KitaController");
Route::resource("users", "UserController");
Route::resource("posts", "PostController");
Route::post("/upload", "MediaController#upload")->name("upload");
Route::get("media", "MediaController#index")->name("media.index");
Route::get("media/{id}/delete", "MediaController#index")->name("media.delete");
Route::get("/media/{id}", "MediaController#download")->name("media");
Route::get("/media/{id}/preview", "MediaController#preview")->name("media.preview");
and now my MediaController:
class MediaController extends Controller
public function index() {
$q = request()->input("q");
if($q) {
$medias= Media::where('name','LIKE','%'.$q.'%')->orderByDesc('created_at')->paginate(10);
}else {
$medias = Media::orderByDesc('created_at')->paginate(10);
}
return view("media.index")->with(["medias" => $medias]);
}
public function upload( Request $request)
{
$request->validate([
"file" => "required"
]);
$name = $request->file("file")->getClientOriginalName();
$extension = $request->file("file")->getClientOriginalExtension();
$size = $request->file("file")->getSize();
$path = $request->file("file")->store("public/media");
Media::create([
"name" => $name,
"extension" => $extension,
"size" => $size,
"path" => $path
]);
return redirect()->route("media.index")->withStatus("Datei wurde erfolgreich hochgeladen!");
}
public function download($id)
{
$media = Media::find($id);
$file = storage_path(). "/app/". $media->path;
return response()->file($file);
}
public function preview($id)
{
$media = Media::whereIn('extension', ["jpg", "png", "gif", "bmp"])->where("id", "=", $id)->first();
$file = storage_path(). "/app/". $media->path;
$preview = Image::make($file)->resize(200, 200);
return $preview->response();
}
public function delete($id)
{
$media = Media::find($id);
$media -> delete();
}
I can click the delete buttons on the website, but nothing happens.
I cant find the solution. or work it out for myself. the sheer amount of different ways you can solve things with coding drives me nuts. I try to code now for like 9 months and i just get slowly forward, since Iam more used to have one solution to get to the goal not 500 differnt ones. Makes me a bit upset to get behind all the stuff.
Do you have also tipps how to learn to code from zero to hero?
thanks!
Pommesfee
SO, thats my delete route:
Route::get("media/{id}/delete", "MediaController#index")->name("media.delete");
and that would be the button to delete the image?
<form action="{{ route('media.delete', [$media->id]) }} method="DELETE">
#method('DELETE')
#csrf
</form>
I dont get behind about that and how to transfer it to my needs.
The default delete route generated by a resourceful route like
Route::resource("foo", "FooController");
will only accept a DELETE request.
Now, there isn't actually a DELETE method for a HTML Form so you will need to do what Laravel refers to as "Form Method Spoofing"
https://laravel.com/docs/7.x/routing#form-method-spoofing
<form action="/foo/bar" method="POST">
#method('DELETE')
#csrf
</form>
If you are looking for a good resource to learn Laravel (and other related frameworks), i would suggest Laracasts
Addendum
You are specifying a GET request which will not work. You should specify a DELETE request like so:
Route::delete("media/{id}/delete", "MediaController#index")->name("media.delete");
You also need to use the POST method on the form AND add the form model spoofing like so:
<form action="{{ route('media.delete', [$media->id]) }} method="POST">
#method('DELETE')
#csrf
</form>

I want a easily understandable code to pick a set of rows from a table based on todays date

I am beginner, I am trying to show a list of employees attendance based on the date say today. I need a code example for the above condition, i tried a lot of methods but none is of my use, I will provide the table structure. Kindly guide me with a step by step procedure, I am really a patience guy.
Table: empatten
================
empid
empname
empstatus (whether present or absent)
doa (date of attendance)
This is my show blade
=====================
#extends ('empatten.layout')
<html>
<head>
<title>Display attendance information</title>
</head>
<body>
<div class="row">
<div class="col-lg-12 margin-tb">
<div class="pull-right">
<a class="btn btn-success" href="{{ route
('empatten.index') }}">Back</a>
</div>
</div>
</div>
<table class="tableizer-table">
<thead>
<tr class="tableizer-firstrow">
<th>Emp ID</th>
<th>Emp Name</th>
<th>Emp Status</th>
<th>Action</th>
</tr></thead><tbody>
#foreach($empatten as $attens)
<tr>
<td>{{ $attens->empid }}</td>
<td>{{ $attens->empname }}</td>
<td>{{ $attens->empstatus }}</td>
<td>{{ $attens->doa }}</td>
</tr>
#endforeach
</tbody></table>
</body>
</html>
This is my Index Page:
=========================
#extends('empatten.layout')
#section('content')
<div class="row">
<div class="col-lg-12 margin-tb">
<div class="pull-left">
<h2>Employee Management Page</h2>
</div>
<br><br>
<div class="pull-left">
<a class="btn btn-success" href="{{ route('empatten.create') }}"> Add Todays Attendance</a>
</div>
<br><br>
<div class="pull-left">
<a class="btn btn-success" href="{{ route('empatten.show') }}"> View Todays Attendance</a>
</div>
</div>
</div>
This is my controller show function
+++++++++++++++++++++++++++++++++++++
public function show(Empatten $empatten)
{
return view('empatten.show',compact('empatten'));
//->with('empatten', empatten::all());
}
Try this,
$employee_attendance = YourModelName::whereDate('doe', Carbon::today())->get();
Here YourModelName is the Your model for empatten table
This is a simple method according to your need.. here \Carbon\Carbon::now() getting the todays date ..
public function show()
{
$empatten = Empatten::where('created_at', Carbon::today())->get();
return view('empatten.show',compact('empatten'));
}

How to save foreach to variable in laravel?

I want to display these elements:
$category->getFullNameAttribute()
$category->id
$category->email
$category->image
Here is my view:
<div class="col-md-12">
<div class="card" style="padding: 20px; overflow: auto;">
<ul id="ul-data" style="display:none;">
#foreach ($categories as $category)
<li class="user-{{ $category->id }}">
{{ $category->getFullNameAttribute() }}
{{ $category->id }}
{{ $category->email }}
{{ $category->image }}
{{-- {{$category->representative}} --}}
#if (count($category->childes))
#include('management.orgchart.manageChild',['childs' => $category->childes])
#endif
</li>
#endforeach
</ul>
<div id="chart-container"></div>
However, when I display them in this way they are all going into the same div title or text.
I am getting big problems because I need it separate into more div because I want to display email at the bottom, the name at the top, id next to image and various other styling choices.
Does anyone know how I can put elements (id, email, image...) into different variables so I can easily manipulate them.
I appreciate your help and I will do everything to fix issues.
If I didn't explain something properly please ask me in comments and I will try my best to explain it in more detail.
Edit: This is controller for that method:
<?php
namespace App\Http\Controllers;
use App\User;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Session;
class OrgController extends Controller
{
/**
* Display the OrgChart.
*
* #return \Illuminate\Http\Response
*/
public function index()
{
Carbon::setLocale(App::getLocale());
if (Session::get('locked') === true) {
return redirect('/lock');
}
$categories = User::where('supervisor_id', '=', null)->get();
return view('management.orgchart.index', compact('categories'));
}
}
This is the model window which appears when pressing the right title of the names.
I want to put data into this div (first name, last name, email etc...):
<div class="modal fade" id="exampleModalLong" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Profile Window</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="text-center">
<div class="img-container">
<img src="img/default-avatar.png" class="img-circle" id="circleImage" alt="Cinque Terre" />
</div>
</div>
<div class="text-center">
<div id="first_name" style="display: inline-block;">First name</div> <br>
<div id="last_name" style="display: inline-block;">Last name</div>
<div id="birthday">00.10.2020</div>
<div id="customer_email">hello#k-tronik.de</div>
<div id="representative_id">Representive Person</div>
<br>
</div>
<p id="contentWin">
{{-- #foreach($categories as $category)
<li class="user-{{ $user->id }}">
{{ $user->getId }}
#if (count($user->childes))
#include('management.orgchart.manageChild',['childs' => $category->childes])
#endif
</li>
#endforeach --}}
Using dummy content or fake information in the Web design process can result in products with unrealistic assumptions and potentially serious design flaws. A seemingly elegant design can quickly begin to bloat with unexpected content or break under the weight of actual activity. Fake data can ensure a nice looking layout but it doesn’t reflect what a
Lorem Ipsum actually is usefull in the design stage as it
Kyle Fiedler from the Design Informer feels that distracting copy is your fault:
If the copy becomes distracting in the design then you are doquestions about lorem ipsum don’t.
Summing up, if the copy is diverting attention from the design it’s because it’s not up to task.
Typographers of yore didn't come up with the concept ot on it. They will be drawn to it, fiercely. Do it the wrong way and draft copy can derail your design review.
Asking the client to pay no attention Lorem Ipsum ing you can't win. Whenever draft copy comes up in a meeting confused questions about it ensue.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
{{--<button type="button" class="btn btn-primary">Save changes</button>--}}
</div>
</div>
</div>
</div>
This might help you,
<div class="col-md-12">
<div class="card" style="padding: 20px; overflow: auto;">
<ul id="ul-data" style="display:none;">
#foreach($categories as $category)
<li class="user-{{ $category->id }}">
<span class="getFullNameAttribute">
{{ $category->getFullNameAttribute()}}
</span>
<span class="id">
{{ $category->id}}
</span>
<span class="email">
{{$category->email}}
</span>
<span class="image">
{{$category->image}}
</span>
<span class="representative">
{{--{{$category->representative}}--}}
</span>
#if(count($category->childes))
#include('management.orgchart.manageChild',['childs' => $category->childes])
#endif
</li>
#endforeach
</ul>
<div id="chart-container"></div>
</div>
You can change markup according to your needs,
and if you want to assign single category variable to other variable you can do this,
#php
$your_variable = $category;
#endphp

Categories