Laravel Edit forms shows blank screen first load - php

Laravel Crud operation
When i open the edit option initially from button link it shows me blank screen as attached in both browser Chrome and FireFox
But when i reload it from the URL by hitting enter it loads the screen
Also when i save the form it return me the GIF image in ajax response.
the module name is advertisement
Is there possibilities the word advertisement can cause the issue?
AdvtController.php
public function edit($uuid)
{
Languages::setBackLang();
$checkPermission = Permissions::checkActionPermission('edit_advertisement');
if ($checkPermission == false) {
return view('backend.access-denied');
}
$advertisementData = Advertisement::loadAdvertise($uuid, Languages::EN);
if (empty($advertisementData)) {
Helper::log('Advertisement edit : No record found');
return redirect()->back()->with('error', trans('backend/common.oops'));
}
$languages = Languages::where('language_id', Languages::EN)->select('language_id', 'name')->first();
$language_id = Languages::getBackLanguageId();
return view('backend.advertisement.edit', compact('languages', 'advertisementData'));
}
edit.blade.php
#extends('backend.layout')
#php
$lang = \App\Models\Languages::getBackLang();
#endphp
#section('scripts')
<script src="{{asset('backend/dist/js/jquery.validate.min.js')}}"></script>
<script src="{{asset('backend/dist/js/pages/custom.js')}}"></script>
<script src="{{asset('backend/dist/js/pages/advt.js')}}"></script>
#endsection
#section('content')
<div class="content-wrapper">
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0 text-dark">{{trans('backend/advertisement.advertisement')}}</h1>
</div><!-- /.col -->
<div class="col-sm-6">
<ol class="breadcrumb {{($lang == 'ar') ? 'float-sm-left':'float-sm-right'}} ">
<li class="breadcrumb-item">{{trans('backend/common.home')}}</li>
<li class="breadcrumb-item">{{trans('backend/advertisement.advertisement')}}
</li>
<li class="breadcrumb-item active">{{trans('backend/common.edit')}}</li>
</ol>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</section>
<!-- /.content-header -->
<section class="content">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">{{trans('backend/advertisement.edit_advertisement')}}</h3>
</div>
<!-- /.card-header -->
<div class="card-body">
<div id="display_message" class="col-md-12 display-none">
<div class="alert display-none alert-success"></div>
<div class="alert display-none alert-danger"></div>
</div>
#include('backend.advertisement.form')
</div>
<!-- /.card-body -->
</div>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
</div>
#endsection

Related

how to put php asset inside background image url laravel

i just want to put the name of the slider image inside foreach loop and all of it is inside css "backgound:image:url()" i want to write the php code inside background-image like css
background-image: url({{url('sliderimages/'.$slider->slider)}});
it dosn't display images
i when i am using asset it didn't work i don't know why please help
here is my foreach blade code
<div class="col-xs-12 col-sm-12 col-md-9 homebanner-holder">
<!-- ========================================== SECTION – HERO ========================================= -->
#foreach ($sliders as $slider)
<div id="hero">
<div id="owl-main" class="owl-carousel owl-inner-nav owl-ui-sm">
<div class="item" style="background-image: url(asset('sliderimages/'$slider->slider));">
<div class="container-fluid">
<div class="caption bg-color vertical-center text-left">
<div class="slider-header fadeInDown-1">{{$slider->title}}</div>
<div class="big-text fadeInDown-1"> New Collections </div>
<div class="excerpt fadeInDown-2 hidden-xs"> <span>{{$slider->description}}</span> </div>
<div class="button-holder fadeInDown-3"> Shop Now </div>
</div>
<!-- /.caption -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /.item -->
#endforeach
<!-- /.item -->
</div>
<!-- /.owl-carousel -->
</div>
If it's in public styles folder:
background-image: url("{{ asset('sliderimages/'.$slider->slider) }}");
in other pathes:
background-image: url("{{url('sliderimages/'.$slider->slider)}}");

When i return value to my view pages then there should be an error . $student is defined variable . I Laravel

here is the function is given below
public function index(){
$student=Administration::Where('payment',1)->get();
//dd($student);
return view('HallAuthority.index',compact('student'));
}
Here is the view blade
<div class="container-fluid page-body-wrapper">
<div class="row row-offcanvas row-offcanvas-right">
<!-- partial:partials/_sidebar.html -->
#include('HallAuthority.inc.sidebar')
<!-- partial -->
<div class="content-wrapper">
<div class="row">
<div class="col-sm-6 col-md-3 grid-margin">
<div class="card">
<div class="card-body">
{{$student->count()}}
<h2 class="card-title">Total sutdent Student</h2>
</div>
<div class="dashboard-chart-card-container">
<div id="dashboard-card-chart-1" class="card-float-chart"></div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-3 grid-margin">
<div class="card">
<div class="card-body">
<h2 class="card-title">Total Department</h2>
</div>
<div class="dashboard-chart-card-container">
<div id="dashboard-card-chart-2" class="card-float-chart"></div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-3 grid-margin">
<div class="card">
<div class="card-body">
<h2 class="card-title">stock price Price</h2>
</div>
<div class="dashboard-chart-card-container">
<div id="dashboard-card-chart-3" class="card-float-chart"></div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-3 grid-margin">
<div class="card">
<div class="card-body">
<h2 class="card-title">Revenue</h2>
</div>
<div class="dashboard-chart-card-container">
<div id="dashboard-card-chart-4" class="card-float-chart"></div>
</div>
</div>
</div>
</div>
</div>
<!-- content-wrapper ends -->
<!-- partial:partials/_footer.html -->
<div class="card card-body">
<div class="card-header text-center">
Mahfujur#2019
</div>
</div>
<!-- partial -->
</div>
<!-- row-offcanvas ends -->
</div>
The Route file is given below
Route::get('/student/hall','HallController#index')->name('student.hall');
Given this type an error
Undefined variable: student (View: C:\xampp\htdocs\ProjectFinall\resources\views\HallAuthority\index.blade.php) (View: C:\xampp\htdocs\ProjectFinall\resources\views\HallAuthority\index.blade.php)*
I get the value properly but i cannot compact this value to the view pages its always shows that it is undefined value i am totally fed up to solve this . Please anyone help me.
Try this
public function index(){
$student=Administration::Where('payment',1)->count();
return view('HallAuthority.index',compact('student'));
}
<div class="card-body">
{{$student}}
<h2 class="card-title">Total sutdent Student</h2>
</div>

PHP (MySQL) Script doesn't read anything else once I add 'echo' and take something from table

I have a problem,
When I tried to list all users, to get their username/and others script didn't continue to read anything, it has stopped just after my echo input.
So when I put echo to get user's info it reads that input but it doesn't read anything after. See bellow there is a echo called 'userEmail' and it reads it with no problems but it doesn't go after signature. Now I have checked any everything works when i put it on a plain page but for some reason it stop readsing here. I'm a newbie in this PHP so yeah. :)
<?php
$query = mysql_query("SELECT userEmail FROM users");
while($userRow= mysql_fetch_array($query)){
echo '<div class="col-md-4">
<!-- Widget: user widget style 1 -->
<div class="box box-widget widget-user">
<div class="widget-user-header bg-blue" style="background-color: center center;">
</div>
<div class="widget-user-image">
<img alt="User Avatar" class="img-circle" src="//">
</div>
<div class="box-footer">
<div class="row">
<div class="col-sm-4 border-right">
<div class="description-block">
</div>
<!-- /.description-block -->
</div>
<!-- /.col -->
<div class="col-sm-4 border-right">
<div class="description-block">
<h5 class="description-header">'.$userRow['userEmail'];'</h5>
<h5 class="description-text">'.$userRow['userSignature'];'</h5>
</div>
<!-- /.description-block -->
</div>
<!-- /.col -->
<div class="col-sm-4">
<div class="description-block"></div>
<!-- /.description-block -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
</div>
<!-- /.widget-user -->
</div>
<!-- /.col -->
</div>';
}
?>
You're ending your echo with a ;. You need to concatenate the string with a . instead:
<h5 class="description-header">'.$userRow['userEmail'];'</h5>
<h5 class="description-text">'.$userRow['userSignature'];'</h5>
This should be:
<h5 class="description-header">'.$userRow['userEmail'].'</h5>
<h5 class="description-text">'.$userRow['userSignature'].'</h5>
in
'.$userRow['
quates are conflict with together
change ' and " with together in all lines of your script
and then :
".$userRow['userEmail']."<
be sure will be ok

Why some custom fields in a section of my WordPress website aren't working?

I'm building a WordPress website. Everything went fine before using custom post types. When I use CPT and write PHP code then a section can't print the custom fields. This affects only one section. Other sections and custom fields works fine.
Before adding this code the custom field worked fine:
<?php
$args = array("post_type" => "project_feature");
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="col-sm-4">
<?php
if(has_post_thumbnail())
{
the_post_thumbnail();
}
?>
<h3><?php the_title(); ?></h3>
<div class="black_text"><?php the_content(); ?></div>
</div> <!-- col -->
<?php endwhile; wp_reset_query(); ?>
But now if I delete this code my custom feature still doesn't work. I don't understand what I am doing wrong. I still don't know if it's my code or something else in WordPress.
This custom fields within the instructor section aren't working:
<?php
// instructor custom fields
$instructor_name = get_field('instructor_name');
$instructor_description = get_field('instructor_description');
$students = get_field('students');
$views = get_field('views');
$courses = get_field('courses');
?>
<!-- INSTRUCTOR
=========================================
-->
<section id="instructor">
<div class="container">
<div class="row">
<div class="col-sm-6">
<div class="row">
<div class="col-sm-8">
<h3>Your Instructor <small><?php echo $instructor_name; ?></small></h3>
</div> <!-- col -->
<div class="col-sm-4">
<ul>
<li>
<i class="fa fa-facebook social" aria-hidden="true"></i>
</li>
<li>
<i class="fa fa-google-plus social" aria-hidden="true"></i>
</li>
<li>
<i class="fa fa-linkedin social" aria-hidden="true"></i>
</li>
</ul>
</div> <!-- col -->
</div> <!-- row -->
<div class="row">
<div class="col-sm-12">
<p class="black_text"><?php echo $instructor_description; ?></p>
<hr>
</div> <!-- col -->
</div> <!-- row -->
<div class="row">
<div class="col-sm-12">
<h3>The numbers <small>They don't lie...</small></h3>
</div> <!-- col -->
<div class="col-sm-4 round_display">
<p class="black_text"><?php echo $students; ?> students</p>
</div> <!-- col -->
<div class="col-sm-4 round_display">
<p class="black_text"><?php echo $views; ?> views</p>
</div> <!-- col -->
<div class="col-sm-4 round_display">
<p class="black_text"><?php echo $courses; ?> courses</p>
</div> <!-- col -->
</div> <!-- row -->
</div> <!-- col -->
<div class="col-sm-6">
<img src="<?php bloginfo('stylesheet_directory'); ?>/image/brad.png" alt="man" class="img-responsive center-block income_image"/>
</div> <!-- col -->
</div> <!-- row -->
</div> <!-- container -->
</section> <!-- INSTRUCTOR -->

wrap div to every 3 items data coming from database

<div class="accordion-content default">
<div class="row">
<div class="col-xs-12 equal">
<!-- <div >content comming from database</div> -->
<!-- <div >content comming from database</div> -->
<!-- <div >content comming from database</div> -->
</div>
<div class="col-xs-12">
<div class="line-border"> </div>
</div>
</div>
<div class="row">
<div class="col-xs-12 equal">
<!-- <div >content comming from database</div> -->
<!-- <div >content comming from database</div> -->
<!-- <div >content comming from database</div> -->
</div>
<div class="col-xs-12">
<div class="line-border"> </div>
</div>
</div>
<div class="row">
<div class="col-xs-12 equal">
<!-- <div >content comming from database</div> -->
</div>
<div class="col-xs-12">
<div class="line-border"> </div>
</div>
</div>
</div>
Above is the HTML code i the div which says content coming from database are the content coming from database and i need to show it 3 per div if in total it comes 19 then it should show 3 each x 6 = 18 and 1 is left that should also be wrapped with the
You have to declare a counter for your loop and reset it every 3 loops. Use the modulo operator to do so.
<?php
$i = 0;
foreach($data as $record) {
if($i == 0) {
echo '<div class="wrapper">';
}
echo $record['some-data'];
if($i%2 == 0 && $i > 0) {
echo '</div>';
$i = 0;
}
else {
$i++;
}
}

Categories