I have a view which I'm returning in my AdminController which goes in this syntax.
public function create_booking(){
$set_admin = SettingAdmin::orderBy('id')->first();
return view('layouts\quickbookingmodal')->with('set_admin', $set_admin);
}
In HTML this is what im returning, this basically is a pop menu, where the admin user can fill a booking.
<div class="modal fade" id="myModal">
<div class=row>
<div class="col-sm-10 offset-sm-1">
<div class="modal-dialog modal-lg">
<form action="" method="POST">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Quick Booking</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<div class="modal-body">
{{ csrf_field() }}
#isset($error_msg)
#foreach ($error_msg as $error)
<li class="text-danger">{{ $error }}</li>
#endforeach
#endisset
<div class="form-group row">
<label for="placeid" class="col-md-4 col-form-label text-md-right">{{ __('Place ID') }}: </label>
<div class="col-md-6">
<input type="text" class="form-control" name="place_id" required>
</div>
</div>
<div class="form-group row">
<label for="placeid" class="col-md-4 col-form-label text-md-right">{{ __('Arrival day') }}: </label>
<div class="col-md-6">
<div class="container11">
<div class="t-datepicker">
<span id="tdatepik" class="t-check-in"></span>
<input id="searchdate_numberofdays" type="number" name="no_of_day" placeholder="{{ __('Number of days') }}: 1">
#isset($maparray['err_msg'])
<span id="errormsg_txt" style="color:red;"> {{ __('You can book maximum') }} {{ $maparray["set_admin"]->max_no_days }} {{ __('days') }}.</span><br>
#endisset
<span id="errormsg_txt" style="color:red;display:none;"> {{ __('Arrival day is not selected') }}. </span><br>
</div>
</div>
</div>
</div>
<div class="form-group row">
<label for="fullname" class="col-md-4 col-form-label text-md-right">{{ __('Full Name') }}: </label>
<div class="col-md-6">
<input type="text" class="form-control" name="user_fullname" required>
</div>
</div>
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('Email address') }}: </label>
<div class="col-md-6">
<input type="email" class="form-control" name="user_email" required>
</div>
</div>
<div class="form-group row">
<label for="phone" class="col-md-4 col-form-label text-md-right">{{ __('Phone') }}: </label>
<div class="col-md-6">
<input type="tel" class="form-control" name="user_phone" required>
</div>
</div>
<div class="form-group row">
<label for="geust" class="col-md-4 col-form-label text-md-right">{{ __('Number of adults') }}[1-4]: </label>
<div class="col-md-6">
<select class="form-control booking_inp_textbox_style" id="numberofguest" name="numberofguest" onchange="addFieldsadmin(this.value);">
<option value="0" active>1</option>
<option value="1">2</option>
<option value="2">3</option>
<option value="3">4</option>
</select>
</div>
</div>
<div class="form-group row">
<label for="babies" class="col-md-4 col-form-label text-md-right">{{ __('Number of babies') }}[1-3]: </label>
<div class="col-md-6">
<select class="form-control booking_inp_textbox_style" id="numberofbabies" name="numberofbabies" onchange="addFieldsadmin2(this.value);">
<option value="0" active>0</option>
<option id="hidden_op_style1" value="1">1</option>
<option id="hidden_op_style2" value="2">2</option>
<option id="hidden_op_style3" value="3">3</option>
</select>
</div>
</div>
<div class="containerinput">
{{-- dynamic input surname using javascript --}}
</div>
<div class="containerinput2">
{{-- dynamic input surname using javascript --}}
</div>
<div class="form-group row">
<label for="promo" class="col-md-4 col-form-label text-md-right">{{ __('Promo Code') }}: </label>
<div class="col-md-6">
<input type="text" class="form-control" name="user_promo">
</div>
</div>
<div class="form-group row">
<label for="book" class="col-md-4 col-form-label text-md-right">{{ __('Booked By') }}: </label>
<div class="col-md-6">
<label>{{ Auth::user()->name }}</label>
</div>
</div>
#if (Auth::user()->role == 'admin')
<div class="form-group row">
<label for="Amount" class="col-md-4 col-form-label text-md-right">{{ __('Payment Type') }}: </label>
<div class="col-md-6">
<input type="radio" name="user_payment_type" value="Entrance">
<label for="Entrance" class="booking_payment_type_style">{{ __('Entrance (Cash)') }}</label>
<input type="radio" name="user_payment_type" value="Admin" checked>
<label for="Entrance" class="booking_payment_type_style">{{ __('Admin (Free)') }}</label><br>
</div>
</div>
#else
<div class="form-group row">
<label for="promo" class="col-md-4 col-form-label text-md-right">{{ __('Payment Type') }}: </label>
<div class="col-md-6">
<input type="radio" name="user_payment_type" value="Entrance" checked>
<label for="Entrance" class="booking_payment_type_style">{{ __('Entrance (Cash)') }}</label>
</div>
</div>
#endif
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-success">{{ __('Save') }}</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
var today = new Date();
tomorrow = new Date(today);
tomorrow.setDate(tomorrow.getDate() + 60);
var date = tomorrow.getFullYear()+'-'+(tomorrow.getMonth()+1)+'-'+tomorrow.getDate();
$(document).ready(function(){
// Call global the function
$('.t-datepicker').tDatePicker({
// options here
titleDateRange :'{{ __('day') }}',
titleDateRanges:'{{ __('days') }}',
titleToday :'{{ __('Today') }}',
limitDateRanges :'{{ $set_admin->max_no_days+1 }}',
titleCheckIn :'{{ __('Check In') }}',
titleCheckOut :'{{ __('Check Out') }}',
numCalendar : 1,
endDate: date,
nextDayHighlighted :false,
toDayHighlighted :true,
toDayShowTitle :true,
autoClose: true,
dateRangesHover: false,
});
});
// $('.t-datepicker').tDatePicker('setEndDate','2020-07-28');
</script>
<script type="text/javascript">
#isset($error_msg)
#if (count($error_msg) > 0)
$('#myModal').modal('show');
#endif
#endisset
</script>
But anytime i load the page, it does not load it as a popup just static HTML. However i have the same popup in this page called dashboard, which when clicked shows the popup perfectly with all the styles. I'm not sure why this is happening.
#extends('layouts.adminmaster')
#section('section')
<div class="container paddingTop20">
<h1>Negombo Admin Panel</h1>
<hr>
<div class="row">
<div class="col-sm-4">
<div class="card">
<div class="card-header bg-primary">
<span class="dashboardcardstyle">{{ __('Quick Booking') }}</span>
</div>
<div class="card-body">
<center><button type="button" class="btn btn-success dashboardcardbodystyle2" data-toggle="modal" data-target="#myModal">{{ __('Book Now') }}</button></center>
#include('layouts.quickbookingmodal')
</div>
</div>
</div>
<div class="col-sm-4">
<div class="card">
<div class="card-header bg-primary">
<span class="dashboardcardstyle">Total Places</span>
</div>
<div class="card-body">
<center><span class="dashboardcardbodystyle">{{ $numberofplace }}</span></center>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="card">
<div class="card-header bg-primary">
<span class="dashboardcardstyle">Total Bookings</span>
</div>
<div class="card-body">
<center><span class="dashboardcardbodystyle">{{ $numberofbookings }}</span></center>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
#include('layouts.recentactivaty')
</div>
<div class="col-sm-2">
</div>
</div>
{{-- second row of dashboard --}}
<div class="row paddingTop20">
<div class="col-sm-4">
#if (Auth::user()->role== "admin")
<div class="card">
<div class="card-header bg-primary">
<span class="dashboardcardstyle">Total Earnings</span>
</div>
<div class="card-body">
<table style="width:100%" align="center" class="table-hover">
<tr>
<td><strong>From Entrance: </strong></td>
<td>{{ $earningEntrance }} <i class="fa fa-eur" aria-hidden="true"></i></td>
</tr>
<tr>
<td><strong>From {{ __('Agreements') }}: </strong></td>
<td>{{ $earningAgr }} <i class="fa fa-eur" aria-hidden="true"></i></td>
</tr>
<tr>
<td><strong>From Paypal: </strong></td>
<td>{{ $earningPaypal }} <i class="fa fa-eur" aria-hidden="true"></i></td>
</tr>
<tr>
<td><strong>From Stripe: </strong></td>
<td> {{ $earningStripe }} <i class="fa fa-eur" aria-hidden="true"></i></td>
</tr>
<tr>
<td><strong>From Credit Card: </strong></td>
<td>{{ $earningcard }} <i class="fa fa-eur" aria-hidden="true"></i></td>
</tr>
</table>
{{-- <center><span class="dashboardcardbodystyle">{{ $numberofbookings }}</span></center> --}}
</div>
</div>
#else
<div class="card">
<div class="card-header bg-primary">
<span class="dashboardcardstyle">Server Time</span>
</div>
<div class="card-body">
<center><span>{{ date("d M, Y") }}</span></center>
<center><span class="dashboardcardbodystyle">{{ date("h:i:s A") }}</span></center>
</div>
</div>
#endif
</div>
<div class="col-sm-4">
<div class="card">
<div class="card-header bg-primary">
<span class="dashboardcardstyle">{{ __('Total') }} {{ __('Agreements') }}</span>
</div>
<div class="card-body">
<center><span class="dashboardcardbodystyle">{{ $numberofAggr }}</span></center>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="card">
<div class="card-header bg-primary">
<span class="dashboardcardstyle">Total Entrance</span>
</div>
<div class="card-body">
<center><span class="dashboardcardbodystyle">{{ $numberofEntrance }}</span></center>
</div>
</div>
</div>
</div>
{{-- second row of dashboard --}}
</div>
#endsection
This is how the popup is supposed to look like.
But this is how it looks
This is what i get when i add the #extends('layouts.adminmaster') and #section('section')
Related
How to show label in a loop.For example label 1, label 2 and so on continuous till the end of the loop.
Here is my code i want to show Experience 1 and Experience 2 and so on through out the loop
till loop ends.
#foreach($employee->experiences as $experince)
<div class="card-header">
<label for="">Experience</label>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<div class="form-group row">
<div class="col-md-6"><b>Company:</b></div>
<div class="col-md-6">{{ ucfirst($experince->company) }}</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group row">
<div class="col-md-6"><b>Degree :</b></div>
<div class="col-md-6">{{ ucfirst($employee->degree) }}</div>
</div>
</div>
</div>
</div>
#endforeach
In blade template there is a $loop variable:
$loop->index
will print the current index, starting from 0
$loop->iteration
will instead start from 1
The variable is available inside a #foreach:
#foreach($employee->experiences as $experince)
{{ $loop->iteration }}
#endforeach
Try this $loop->iteration ref link https://laravel.com/docs/8.x/blade#the-loop-variable
#foreach($employee->experiences $experince)
<div class="card-header">
<label for="">Experience {{ $loop->iteration }}</label>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<div class="form-group row">
<div class="col-md-6"><b>Company:</b></div>
<div class="col-md-6">{{ ucfirst($experince->company) }}</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group row">
<div class="col-md-6"><b>Degree :</b></div>
<div class="col-md-6">{{ ucfirst($employee->degree) }}</div>
</div>
</div>
</div>
</div>
#endforeach
Create it variable as iteration and increment it each iterations
#php
$it = 1;
#endphp
#foreach($employee->experiences as $experince)
<div class="card-header">
<label for="">Experience</label>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<div class="form-group row">
<div class="col-md-6"><b>Label:{{ $it }}</b></div>
<div class="col-md-6"><b>Company:</b></div>
<div class="col-md-6">{{ ucfirst($experince->company) }}</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group row">
<div class="col-md-6"><b>Degree :</b></div>
<div class="col-md-6">{{ ucfirst($employee->degree) }}</div>
</div>
</div>
</div>
</div>
#php
$it += 1;
#endphp
#endforeach
I need to edit the error that shows if a user enters an amount below minimum but I can't find the file to edit the pop-up error response that shows if the amount I less than the withdrawal limit.
Here is the code.
<div class="row">
<div class="col-md-9">
<div class="card">
<div class="card-header">
<h4 class="card-title">withdrawal -
<small class="category">Cash Out Fund.</small>
</h4>
</div>
<div class="card-content">
<div class="row">
<div class="col-md-2">
<ul class="nav nav-pills nav-pills-icons nav-pills-primary nav-stacked" role="tablist">
<li class="active">
<a href="#withdraw" role="tab" data-toggle="tab">
<i class="material-icons">redeem</i>Withdraw
</a>
</li>
</ul>
</div>
<div class="col-md-10">
<div class="tab-content">
<div class="tab-pane active" id="withdraw">
<div class="alert alert-info">
<span class="text-center">Please Read before you proceed. You need to know processing fee:</span><br> #php $id=0;#endphp #foreach($gateways as $gateway) #php $id++;#endphp
<span>{{$id}}. <b>#if($gateway->name){{$gateway->name}}#endif #if($gateway->local_name){{$gateway->local_name}}#endif</b> we would charge you <b>{{config('app.currency_symbol')}} {{$gateway->fixed}}</b> fixed + <b>{{$gateway->percent}}%</b> to Withdraw.</span> #endforeach
</div>
<form action="{{route('userWithdraw.post')}}" method="post">
{{ csrf_field() }} #if(count($errors) > 0)
<div class="alert alert-danger alert-with-icon" data-notify="container">
<i class="material-icons" data-notify="icon">notifications</i>
<span data-notify="message">
#foreach($errors->all() as $error)
<li><strong> {{$error}} </strong></li>
#endforeach
</span>
</div>
<br> #endif
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="form-group label-floating">
<select class="selectpicker" name="gateway" data-style="btn btn-warning btn-round" title="Select Withdraw Gateway" data-size="7">
#if($gate->status == 1)
<option value="1000">{{$gate->name}}</option>
#endif #foreach($gateways as $gateway)
<option value="{{$gateway->id}}">{{$gateway->name}}</option>
#endforeach
</select>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="form-group label-floating">
<label class="control-label" for="account">Your PayPal</label>
<input id="account" name="account" type="text" class="form-control">
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="form-group label-floating">
<label class="control-label" for="amount">Withdraw Amount</label>
<input id="amount" name="amount" type="text" class="form-control">
</div>
</div>
</div>
I need to edit all error response that pops up in the file and any other error response on the entire website.
I'm working in php laravel what i want is to upload an image in a form that is used to add new CATEGORY: category name, description and upload image.
my view is as shown:
#extends('layouts.app', ['activePage' => 'category', 'titlePage' => __('Category Management')])
#section('content')
#include('modal.editCategory');
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<form id="categoryForm">
#csrf
#method('post')
<div class="card ">
<div class="card-header card-header-primary">
<h4 class="card-title">{{ __('Add Category') }}</h4>
<p class="card-category"></p>
</div>
<div class="card-body ">
<div class="row">
<div class="col-md-12 text-right">
{{ __('Back to Feeds') }}
</div>
</div>
<div class="row">
<label class="col-sm-2 col-form-label">{{ __('Name') }}</label>
<div class="col-sm-7">
<div class="form-group{{ $errors->has('name') ? ' has-danger' : '' }}">
<input class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" name="category" id="category" type="text" placeholder="{{ __('Name') }}" value="" required="true" aria-required="true"/>
</div>
</div>
</div>
<div class="row">
<label class="col-sm-2 col-form-label">{{ __('Description') }}</label>
<div class="col-sm-7">
<div class="form-group{{ $errors->has('name') ? ' has-danger' : '' }}">
<textarea class="md-textarea form-control" rows="5" name="desc" id="desc" type="text" placeholder="{{ __('Description') }}" value="" required="true" aria-required="true"></textarea>
</div>
</div>
</div>
</div>
<div class="card-footer ml-auto mr-auto">
<button type="button" class="btn btn-primary newCategory">{{ __('Add Category') }}</button>
</div>
</div>
</form>
</div>
</div>
<div class="card">
<div class="card-header card-header-primary">
<h4 class="card-title ">{{ __('Category List') }}</h4>
<p class="card-category"> {{ __('Here you can manage categories') }}</p>
</div>
<div class="card-body">
#if (session('status'))
<div class="row">
<div class="col-sm-12">
<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<i class="material-icons">close</i>
</button>
<span>{{ session('status') }}</span>
</div>
</div>
</div>
#endif
<div class="table-responsive ">
<table class="table display responsive nowrap table-striped" id="category-datatable" width="100%" cellspacing="0">
<thead class=" text-primary ">
<th>
{{ __('No') }}
</th>
<th>
{{ __('Name') }}
</th>
<th>
{{ __('Description') }}
</th>
<th class="text-right">
{{ __('Actions') }}
</th>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
#endsection
I used ajax to submit value from view to controller as shown below:
// add category
$('.newCategory').click(function (e) {
e.preventDefault();
var formData = $("#categoryForm").serialize();
$('.error-msg').html('');
$.ajax({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
url: baseUrl + 'addCategory',
type: 'GET',
data: formData,
success: function (data) {
localStorage.setItem("swal",
swal({
title: "Success!",
text: "Category Added",
type: "success",
timer: 3000,
showConfirmButton: false
})
);
location.reload();
localStorage.getItem("swal");
}
});
});
An this is my controller:
public function addCategory(Request $request)
{
$name=$request->input('category');
$desc=$request->input('desc');
$created_at=Carbon::now();
$updated_at=Carbon::now();
$data=array('name'=>$name,'description'=>$desc,'created_at'=>$created_at,'updated_at'=>$updated_at);
Category::insert($data);
}
Can someone help me with this?
"count(): Parameter must be an array or an object that implements
Countable (View:
D:\xampp\htdocs\btrade\core\resources\views\dashboard\user-details.blade.php)"
Looking for I saw that some have this error in their code, but I did not find how can i solve my problem please help me
i think This is the failing case:
#if(count($user))
My php version : PHP 7.2.0
this my error imge
this is my code
#extends('layouts.dashboard')
#section('style')
<link href="{{ asset('assets/admin/css/bootstrap-toggle.min.css') }}" rel="stylesheet">
#endsection
#section('content')
#if(count($user))
<div class="row">
<div class="col-md-12">
<div class="portlet blue box">
<div class="portlet-title">
<div class="caption font-dark">
<strong>User Details</strong>
</div>
<div class="tools"> </div>
</div>
<div class="portlet-body" style="overflow:hidden;">
<div class="col-md-3">
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption uppercase bold">
<i class="fa fa-user"></i> PROFILE </div>
</div>
<div class="portlet-body text-center" style="overflow:hidden;">
<img src="#if($user->image == 'user-default.png') {{ asset('assets/images/user-default.png') }} #else {{ asset('assets/images') }}/{{ $user->image }}#endif" class="img-responsive propic" alt="Profile Pic">
<hr><h4 class="bold">User Name : {{ $user->username}}</h4>
<h4 class="bold">Name : {{ $user->name }}</h4>
<h4 class="bold">BALANCE : {{ $user->balance }} {{ $basic->currency }}</h4>
<hr>
#if($user->login_time != null)
<p>
<strong>Last Login : {{ \Carbon\Carbon::parse($user->login_time)->diffForHumans() }}</strong> <br>
</p>
<hr>
#endif
#if($last_login != null)
<p>
<strong>Last Login From</strong> <br> {{ $last_login->user_ip }} - {{ $last_login->location }} <br> Using {{ $last_login->details }} <br>
</p>
#endif
</div>
</div>
</div>
<div class="col-md-9">
<div class="row">
<div class="col-md-12">
<div class="portlet box purple">
<div class="portlet-title">
<div class="caption uppercase bold">
<i class="fa fa-desktop"></i> Details </div>
<div class="tools"> </div>
</div>
<div class="portlet-body">
<div class="row">
<!-- START -->
<a href="{{ route('user-repeat-all',$user->username) }}">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12" style="margin-bottom: 20px;">
<div class="dashboard-stat blue">
<div class="visual">
<i class="fa fa-recycle"></i>
</div>
<div class="details">
<div class="number">
<span data-counter="counterup" data-value="{{ $total_repeat }}">0</span>
</div>
<div class="desc uppercase bold"> REPEAT </div>
</div>
<div class="more">
<div class="desc uppercase bold text-center">
{{ $basic->symbol }}
<span data-counter="counterup" data-value="{{ $total_repeat_amount }}">0</span> REPEAT
</div>
</div>
</div>
</div>
</a>
<!-- END -->
<a href="{{ route('user-deposit-all',$user->username) }}">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12" style="margin-bottom: 20px;">
<div class="dashboard-stat green">
<div class="visual">
<i class="fa fa-cloud-download"></i>
</div>
<div class="details">
<div class="number">
<span data-counter="counterup" data-value="{{ $total_deposit }}">0</span>
</div>
<div class="desc uppercase bold "> DEPOSIT </div>
</div>
<div class="more">
<div class="desc uppercase bold text-center">
{{ $basic->symbol }}
<span data-counter="counterup" data-value="{{ $total_deposit_amount }}">0</span> DEPOSIT
</div>
</div>
</div>
</div>
</a>
<!-- END -->
<a href="{{ route('user-withdraw-all',$user->username) }}">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12" style="margin-bottom: 20px;">
<div class="dashboard-stat red">
<div class="visual">
<i class="fa fa-cloud-upload"></i>
</div>
<div class="details">
<div class="number">
<span data-counter="counterup" data-value="{{ $total_withdraw }}">0</span>
</div>
<div class="desc uppercase bold "> WITHDRAW </div>
</div>
<div class="more">
<div class="desc uppercase bold text-center">
{{ $basic->symbol }}
<span data-counter="counterup" data-value="{{ $total_withdraw_amount }}">0</span> WITHDRAW
</div>
</div>
</div>
</div>
</a>
<!-- END -->
<a href="{{ route('user-login-all',$user->username) }}">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12" style="margin-bottom: 20px;">
<div class="dashboard-stat yellow">
<div class="visual">
<i class="fa fa-sign-in"></i>
</div>
<div class="details">
<div class="number">
<span data-counter="counterup" data-value="{{ $total_login }}">0</span>
</div>
<div class="desc uppercase bold "> Log In </div>
</div>
<div class="more">
<div class="desc uppercase bold text-center">
VIEW DETAILS
</div>
</div>
</div>
</div>
</a>
<!-- END -->
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="portlet box blue-ebonyclay">
<div class="portlet-title">
<div class="caption uppercase bold">
<i class="fa fa-cogs"></i> Operations </div>
</div>
<div class="portlet-body">
<div class="row">
<div class="col-md-6 uppercase">
<i class="fa fa-money"></i> add / substruct balance
</div>
<div class="col-md-6 uppercase">
<i class="fa fa-envelope-open"></i> Send Email
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="portlet box green">
<div class="portlet-title">
<div class="caption uppercase bold">
<i class="fa fa-cog"></i> Update Profile </div>
</div>
<div class="portlet-body">
<form action="{{ route('user-details-update') }}" method="post">
{!! csrf_field() !!}
<input type="hidden" name="user_id" value="{{ $user->id }}">
<div class="row uppercase">
<div class="col-md-4">
<div class="form-group">
<label class="col-md-12"><strong>Name</strong></label>
<div class="col-md-12">
<input class="form-control input-lg" name="name" value="{{ $user->name }}" type="text">
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="col-md-12"><strong>Email</strong></label>
<div class="col-md-12">
<input class="form-control input-lg" name="email" value="{{ $user->email }}" type="text">
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="col-md-12"><strong>Phone</strong></label>
<div class="col-md-12">
<input class="form-control input-lg" name="phone" value="{{ $user->phone }}" type="text">
</div>
</div>
</div>
</div><!-- row -->
<br><br>
<div class="row uppercase">
<div class="col-md-4">
<div class="form-group">
<label class="col-md-12"><strong>STATUS</strong></label>
<div class="col-md-12">
<input data-toggle="toggle" {{ $user->status == 0 ? 'checked' : ''}} data-onstyle="success" data-size="large" data-offstyle="danger" data-on="Active" data-off="Blocked" data-width="100%" type="checkbox" name="status">
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="col-md-12"><strong>EMAIL VERIFICATION</strong></label>
<div class="col-md-12">
<input data-toggle="toggle" {{ $user->email_verify == 1 ? 'checked' : ''}} data-onstyle="success" data-size="large" data-offstyle="danger" data-on="Verified" data-off="Not Verified" data-width="100%" type="checkbox" name="email_verify">
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="col-md-12"><strong>PHONE VERIFICATION</strong></label>
<div class="col-md-12">
<input data-toggle="toggle" {{ $user->phone_verify == 1 ? 'checked' : ''}} data-onstyle="success" data-size="large" data-offstyle="danger" data-on="Verified" data-off="Not Verified" data-width="100%" type="checkbox" name="phone_verify">
</div>
</div>
</div>
</div><!-- row -->
<br><br>
<div class="row">
<div class="col-md-12">
<button type="submit" class="btn blue btn-block btn-lg">UPDATE</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div><!-- col-9 -->
</div>
</div>
</div>
</div><!-- ROW-->
#else
<div class="text-center">
<h3>No User Found</h3>
</div>
#endif
#endsection
#section('scripts')
<script src="{{ asset('assets/admin/js/bootstrap-toggle.min.js') }}"></script>
<script src="{{ asset('assets/admin/js/jquery.waypoints.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('assets/admin/js/jquery.counterup.min.js') }}" type="text/javascript"></script>
#endsection
The $user variable isn't an array. If that variable must not be an array remove the count function from if statement.
In php5, php7.0, php7.1 it works, but in php7.2 does not work.
#if($user)...
for laravel use below code in web.php
if (version_compare(PHP_VERSION, '7.2.0', '>=')) {
// Ignores notices and reports all other kinds... and warnings
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
// error_reporting(E_ALL ^ E_WARNING); // Maybe this is enough
}
PHP had changed function count() in version 7.2.
In PHP 7.3 will add is_countable();
You can add this function:
function is_countable($var) {
return (is_array($var) || $var instanceof Countable);
}
if (is_countable($user) && count($user)) {
//
}
and remove it in PHP 7.3
I am using laravel 5.3 for my project. I have a panel bootstrap that have some cart in that. each cart has some feature. i want to define a cart class and create new object of that with button using jquery.
I am new in laravel.
I found, i can use #include for use cart in my code,but i cant change parameter of that.
How can i do that?
Main.blade.php:
<div class="col-md-6">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#AddGorohkary">add</button>
</div>
<div class="row" >
<div class="col-md-12" >
<ul class="horizontal-slide" dir="ltr" >
#include("Panel")
</ul>
</div>
</div><!-- row -->
Panel.blade.php:
<li class="col-md-3" >
<div class="panel panel-primary" >
<div class="panel-heading">
<div class="row">
<div data-toggle="tooltip" data-placement="bottom" title="حذف این گروه کاری" class="col-md-1 col-sm-1 col-xs-1 col-lg-1 col-md-offset-1">
<button onclick=" remove_entry($(this).parent().parent().parent().parent());" style="color: black;" type="button" class="close" aria-label="Close"><span aria-hidden="true">×</span></button>
</div>
<div data-toggle="tooltip" data-placement="bottom" title="تنظیمات" class="col-md-1 col-sm-1 col-xs-1 col-lg-1">
<span data-toggle="modal" data-target="#SettingModal" dir="rtl" style="color: black;" class=" glyphicon glyphicon-cog " aria-hidden="false"></span>
</div>
<div data-toggle="tooltip" data-placement="bottom" title="باز کردن صفحه گروه کاری" class="col-md-1 col-sm-1 col-xs-1 col-lg-1">
<a style="color: black;" href='/SpecialGoruhKary'><span class='glyphicon glyphicon-export' aria-hidden="false"></span></a>
</div>
<div data-toggle="tooltip" data-placement="bottom" title="اضافه کردن دانش آموز جدید" class="col-md-1 col-sm-1 col-xs-1 col-lg-1">
<span style="color: green;" class="glyphicon glyphicon-plus" aria-hidden="false"></span>
</div>
<div class="col-md-5 col-sm-5 col-xs-5 col-lg-5">
<span>#yield("GorohKarbariName")</span>
</div>
</div>
</div>
<div class="panel-body" style=" overflow-y: scroll;" >
#yield("table_body")
</div>
</div>
</li>
<!---------------------------------- Modal ---------------------------------------------------->
<div id="SettingModal" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg">
<!-- Modal content-->
<div class="modal-content">
<div dir="rtl" class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title ">مشخصات این گروه کاری</h4>
</div>
<div class="modal-body">
<form dir="rtl" class="form-horizontal" action="{{ url('image-upload') }}" enctype="multipart/form-data" method="post" id="viewGorohkaryForm" >
{{ csrf_field() }}
<!-- Text input-->
<div class="form-group">
<div class="col-md-5 col-md-offset-3 inputGroupContainer">
<div dir="ltr" class="input-group">
<input dir="rtl" id="GorohKaryName" name="GorohKaryName" placeholder="اسم گروه کاری" class="form-control" type="text">
<span class="input-group-addon"><i class="glyphicon glyphicon-tag"></i></span>
</div>
</div>
<label for="GorohKaryName" class="col-md-2 control-label">اسم گروه کاری <span style="color: red">*</span> </label>
</div>
<!-- Text input-->
<div class="row col-md-offset-3">
<div class="form-group col-md-3">
<div class=" inputGroupContainer">
<div class=" clockpicker" data-placement="left" data-align="top" data-autoclose="true">
<div dir="ltr" class="input-group">
<input id="ValidTime" type="text" class="form-control" value="08:00">
<span class="input-group-addon">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
</div>
</div>
<div class="form-group col-md-4 ">
<div class=" inputGroupContainer">
<div dir="ltr" class="input-group col-md-offset-1">
<select style="direction: rtl;" class="form-control" id="day" name="day" required="required">
<option value="" data-hidden="true">روز هفته</option>
<option value="0">شنبه</option>
<option value="1">یکشنبه</option>
<option value="2">دوشنبه</option>
<option value="3">سه شنبه</option>
<option value="4">چهارشنبه</option>
<option value="5">پنجشنبه</option>
<option value="6">جمعه</option>
</select>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<div class="form-group col-md-2">
<div class=" inputGroupContainer">
<div dir="ltr" class="input-group">
<button type="button" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</button>
</div>
</div>
</div>
<label for="ValidTime" class="col-md-2 control-label" >زمان معتبر<span style="color: red">*</span> </label>
</div><!-- row clock-->
</form>
</div><!---modal body--->
<div class="modal-footer">
<button id="CreateNewGorohkary" type="submit" class="btn btn-warning" data-dismiss="modal">ذخیره <span class="glyphicon glyphicon-save"></span></button>
</div>
</div><!-- modal content-->
</div>
</div>
You can use of Including Sub-Views section of this link.
In that link you can see how send parameter to an include page.