bekaskaki

bekaskaki

Member Since 7 Months Ago

indonesia

Experience Points
4,010
Total
Experience

990 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
1
Lessons
Completed
Best Reply Awards
3
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
4,010 XP
Oct
16
20 hours ago
Activity icon

Replied to Image Is Saving As .tmp File In Database Laravel

here example upload image:

 public function store(Request $request)
    {
        $validator = Validator::make($request->all(), [

      
            'title' => 'required|string',
            'body' => 'required|string',
            'image' => 'file|mimes:jpg,gif,svg',
        ]);
       
        if ($validator->passes()) {
            $input = $request->all();
            if ($request->hasFile('image')) {
                $file = $request->file('image');
                $file_extension = $file->getClientOriginalName();
                $destination_path = public_path() . '/folder/images/';
                $filename = $file_extension;
                $request->file('image')->move($destination_path, $filename);
                $input['image'] = $filename;
            }
            Images::create($input);
            return Redirect::to('admin/' . $this->title)->with('success', 'Success');
        }
    }

Oct
15
1 day ago
Activity icon

Replied to Show If Checkbox Is Checked Or Unchecked In Edit View

for the second case

i use multiple checkbox because I have a unit field in the table. The field will contain several values such as unit1, unit2, unit3, unit4. so I use the array data type to enter the data into one field.

I have another question, which one is better to use the array data type or create a field in the table for each unit?

Activity icon

Replied to Show If Checkbox Is Checked Or Unchecked In Edit View

i try this but not work :

<div class="checkbox">
  <label>
  <input type="checkbox" name="bidang[]"  value="Pendidikan" {{ (is_array(old('bidang')) && in_array('Pendidikan', old('bidang'))) ? ' checked' : '' }}>Pendidikan
 </label>
  </div>

is there anything I have to change in the controller?

Activity icon

Started a new conversation Show If Checkbox Is Checked Or Unchecked In Edit View

how to show checked unchecked in multiple checkbox laravel edit blade view

ps: array data

edit blade view :

<form method="POST" action="{{url('user/rencana-kerjasama/edit')}}" enctype="multipart/form-data" class="form-horizontal">
{{ csrf_field() }} 
 <div class='col-md-6'>
<div class="checkbox">
  <label>
  <input type="checkbox" name="bidang[]"  value="Pendidikan" @if(is_array(old('bidang')) && in_array('Pendidikan', old('bidang'))) checked @endif>Pendidikan
 </label>
  </div>
<div class="checkbox">
 <label>
<input type="checkbox" name="bidang[]" value="Penelitian" > Penelitian
 </label>
</div>
 <div class="checkbox">
 <label>
  <input type="checkbox" name="bidang[]"  value="Pengabdian Masyarakat"> Pengabdian Masyarakat
 </label>
 </div>
</div>
</form>

controller :

 public function edit($id)
    {
        $title = $this->title;
        $data = RencanaKerjasama::find($id);
        return view('user.' . $title . '.edit', compact('title', 'data'));
    }

i use this but not work

@if(is_array(old('bidang')) && in_array('Pendidikan', old('bidang'))) checked @endif

Oct
12
4 days ago
Activity icon

Replied to Different Model Method

means i have to add an id like this


public function user()
    {
        return $this->belongsToMany('App\User','role_id','id');
    }
Activity icon

Started a new conversation Different Model Method

what different two method below?

public function user()
    {
        return $this->belongsToMany(App\User::class);
    }

    public function user()
    {
        return $this->belongsToMany('App\User','role_id');
    }
Oct
10
6 days ago
Activity icon

Replied to Remove Commas Or Whitespace In Array Data

display in view table like this :

testttt, dinas, bupati

, , // i want remove this

, , // i want remove this

, ,// i want remove this

so my table will look like :

testttt, dinas, bupati

//no commas or whitespace

i use str_replace but if data null "commas" and white space still appear

can i use trim to solve my problem?

Activity icon

Started a new conversation Remove Commas Or Whitespace In Array Data

how to remove whitespace in array data.

i have array data like this :

array:1 [▼
  0 => {#386 ▼
    +"id": 1
    +"deskripsi": "kesepakatan bersama"
    +"jenis": "MoU"
    +"tgl_mulai": "2019-10-01"
    +"tgl_selesai": "2019-11-09"
    +"pihak_1": "muhammada, dinasa, kadisa"
    +"pihak_2": "muhassmmad, dinas, kadis"
    +"pihak_3": ", , "
    +"pihak_4": ", , " 
    +"pihak_5": ", , "
    +"created_at": null
    +"updated_at": null
    +"status": "Masih Berjalan"
  }
]

store controller :

  public function store(Request $request)
    {
        $deskripsi = $request->deskripsi;
        $jenis = $request->jenis;
        $tgl_mulai = date('Y-m-d', strtotime($request->tgl_mulai));
        $tgl_selesai = date('Y-m-d', strtotime($request->tgl_selesai));
        $pihak_1 = implode(', ', $request->pihak_1);
        $pihak_2 = implode(', ', $request->pihak_2);
        $pihak_3 = implode(', ', $request->pihak_3);
        $pihak_4 = implode(', ', $request->pihak_4);

        $data = array(
           'deskripsi' =>  $deskripsi,
           'jenis' =>  $jenis ,
            'tgl_mulai' =>  $tgl_mulai,
            'tgl_selesai' => $tgl_selesai,
            'pihak_1' => $pihak_1,
             'pihak_2' =>  $pihak_2,
             'pihak_3' =>  $pihak_3,
             'pihak_4' =>  $pihak_4,
        );

        $query_insert = DB::table('kesepakatan_bersamas')->insert($data);

       return redirect('admin/'.$this->title)->with('success', 'Data Berhasil Di Update!');

    }

i use this for show the data :

 $data = DB::select('SELECT * ,
                        CASE WHEN DATEDIFF(tgl_selesai, CURDATE()) <= 0 THEN "Berakhir"
                        WHEN DATEDIFF(tgl_selesai, CURDATE()) < 30  THEN "Akan Berakhir"
                        ELSE "Masih Berjalan"
                        END status
                        FROM kesepakatan_bersamas');
return view('admin.'.$title.'.index', compact('title','data'));

in blade view i use @foreach($data as $dt) :

 <td class="text-center">
 {{ !empty($dt->pihak_1) ? str_replace(', ','/ ',$dt->pihak_1) :'' }}
{{ !empty($dt->pihak_2) ? str_replace(', ','/ ',$dt->pihak_2) :'' }} <br>
{{ !empty(str_replace(', ','',$dt->pihak_3)) ? str_replace(', ','/',$dt->pihak_3) :'' }}  <br>
{{ !empty(str_replace(', ','',$dt->pihak_4)) ? str_replace(', ','/ ',$dt->pihak_4) :'' }} <br>
</td>

how to remove the white space..i use str_replace but if data null 'commas' still appear in the view

Oct
09
1 week ago
Activity icon

Started a new conversation Show Data In View From Different Table

i have 3 table

evaluation

id | pks_id | ksb_id | problem | status

pks_id and ksb_id have default value "0"

PKS

id|description|part_1 | part_2 | part_3

KSB

id|description|part_1 | part_2 | part_3

blade view :

@foreach($evaluation as $dt)
<tr>
<td class="text-center"> 
@if($dt->pks_id == '0')
KSB {{ Helper::getDetail('ksb', $dt->ksb_id,'description','id')  }}
@elseif($dt->ksb_id == '0')
PKS {{ Helper::getDetail('pks', $dt->pks_id,'description','id')  }}</td>

<td class="text-center">Part 1</td> // show data pks_id "0" and ksb_id "1" or otherwise

<td class="text-center">Part 2 and 3</td> show data pks_id "0" and ksb_id "1" or otherwise 
</tr>
@endforeach

pks_id and ksb_id will have many value not only one

how to show data in blade view if pks_id "0" and ksb_id "1" or otherwise. part 1, part 2 and part 3 related to pks and ksb table.

i want show data like this

name     |      part        | 

pks test1|  pks1 | pks2,pks3

ksb test1  | ksb1 | ksb2,ksb3

pks test2|  pks1 | pks2,pks3

ksb test2  | ksb1 | ksb2,ksb3
Oct
08
1 week ago
Activity icon

Replied to Ordering By Two Numbers

try :

User::orderBy('name', 'ASC')
    ->orderBy('email', 'ASC')
    ->get(); 
Oct
05
1 week ago
Activity icon

Replied to Insert Multiple Value Into One Field Database

I have a field "reason" in the database table that field I use to store the data. data like this

sample data 1

sample data 2

sample data 3

in the view, I use one input text to enter that data

is there a better way to do that?

Activity icon

Started a new conversation Insert Multiple Value Into One Field Database

I want to insert multiple value in 'example' field

example value:

1. example value 1
2. example value 2
3. example value 3

controller :

public function store(Request $request)
    {
        $validator = Validator::make($request->all(), [
         'pks_id' => 'string',
          'example' => 'required',
           'test' => 'required',
      ]);
      if ($validator->passes()) {
        $input = $request->all();
        Evaluasi::create($input);
         return Redirect::to('admin/'.$this->title)->with('success','testing');
      }else{
            return Redirect::to('admin/'.$this->title)->with('error','oppsss');
      }
    }

db structure :

 Schema::create('evaluasis', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('pks_id')->nullable()->default(0);
            $table->string('example');
            $table->string('test');
            $table->timestamps();
        });

form :

 <form class="form-horizontal" method="POST" action="{{url('admin/evaluasi/store')}}" enctype="multipart/form-data">
                    {{ csrf_field() }}
                    <div class="box-body">
                        <div class="form-group">
                            <label for="inputEmail3" class="col-sm-3 control-label">Name</label>
                            <div class="col-sm-6">
                                <select name="pks_id" id="" class="form-control select2">
                                    <option value="0">Select</option>
                                    @foreach ($data as $key => $value)
                                      <option value="{{$key}}">{{$value}}</option>
                                    @endforeach
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputEmail3" class="col-sm-3 control-label">Example</label>
                            <div class="col-sm-6">
                               <textarea name="example" id="" cols="30" rows="4" class="form-control"></textarea>
                            </div>
                        </div>
<div class="form-group">
                            <label for="inputEmail3" class="col-sm-3 control-label">Test</label>
                            <div class="col-sm-6">
                               <textarea name="test" id="" cols="30" rows="4" class="form-control"></textarea>
                            </div>
                        </div>
                    </div>
                    <div class="box-footer">
                        <button type="reset" class="btn btn-danger">Cancel</button>
                        <button type="submit" class="btn btn-info">Save</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
Oct
03
1 week ago
Activity icon

Replied to Calculate Years Beetwen Two Dates

i'm use this :

$data = DB::select('SELECT * , TIMESTAMPDIFF( YEAR, start_date, end_date ) as _year
FROM example');

and the next question is how to combine 2 mysql commands :

$data = DB::select('SELECT * ,IF(DATEDIFF(STR_TO_DATE(end_date, "%Y-%m-%d"), CURDATE())<=0,"Active","Non-active") status FROM example');

and

$data = DB::select('SELECT * , TIMESTAMPDIFF( YEAR, start_date, end_date ) as _year
FROM example');

I want to get results like this :

description : test
unit = test1
start_date = 2019/10/6
end_date = 2020/10/6
_year = 1
status = Active or Non-active

Activity icon

Started a new conversation Calculate Years Beetwen Two Dates

i have database table field :

description
unit
start_date
end_date

for example :

start_date : 05-07-2019

end_date : 10-08-2021

how I calculate number of years?

Oct
01
2 weeks ago
Activity icon

Replied to Redirect To User Or Admin Page

wrong questions

Activity icon

Started a new conversation Redirect To User Or Admin Page

how when a user has logged in and tried to access the '/ home' page, it will be redirected to the user / admin page

example: users who have accessed the page http://127.0.0.1:8000/ or http://127.0.0.1:8000/home, it will be redirected to page http://127.0.0.1:8000/user or http: //127.0 .0.1: 8000 / admin

login controller:

<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;

class LoginController extends Controller
{

    use AuthenticatesUsers;

   
    protected $redirectTo = '/';

    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }

    protected function authenticated(Request $request, $user)
    {
         // to admin dashboard
        if($user->isAdmin()) {
            return redirect(route('admin-dashboard'));
        }

        // to user dashboard
        else if($user->isUser()) {
            return redirect(route('user-dashboard'));
        }

        abort(404);
    }
}

route :

<?php

// Route::get('/', function () {
//     return view('welcome');
// });

Auth::routes();

Route::get('/', '[email protected]')->name('home');

// user protected routes
Route::group(['middleware' => ['auth', 'user'], 'prefix' => 'user'], function () {

    Route::get('/', '[email protected]')->name('user-dashboard');

});

// admin protected routes
Route::group(['middleware' => ['auth', 'admin'], 'prefix' => 'admin'], function () {
    Route::get('/', 'Admin\[email protected]')->name('admin-dashboard');

    Route::get('user', 'Admin\[email protected]')->name('user');
});
Sep
22
3 weeks ago
Activity icon

Started a new conversation Delete Data Product

I have 3 tables

  • product
id,name,price
  • sale
id, product_id,sale_price
  • purchase
id, product_id,purchase_price

how to delete a product, if the data sale and purchase 0 then the product will be deleted but if the data is not 0 the product will not deleted

I use this:

 public function destroy($id)
    {
        $products = Product::find($id);
        if (count($products->sale_detail) == 0 && count($products->purchase_detail) == 0) {
            $products->delete;
            return redirect($this->title)->with('success', 'Procuct Deleted!!');
        } else {
            return redirect($this->title)->with('error', 'Something Went Wrong!!');
        }
    }

but it doesn't work

model product:

  public function purchase_detail()
    {
        return $this->hasMany('App\Model\PurchaseDetail');
    }

 public function sale_detail()
    {
        return $this->hasMany('App\Model\SaleDetail');
    }

model sale:

 public function product()
    {
        return $this->belongsTo(App\Model\Product);
    }

model purchase:

 public function product()
    {
        return $this->belongsTo(App\Model\Product);
    }
Sep
16
1 month ago
Activity icon

Replied to Logic Checkin Method

its works

thanks

Activity icon

Replied to Logic Checkin Method

how do i return 1 if the difference day 0?

can you give me a sample code?

Activity icon

Started a new conversation Logic Checkin Method

I built a hotel booking system but i have a problem with the checkin method if I do checkin and checkout, for example:

check in date: 2019-09-17 00:22:00
checkout date: 2019-09-17 12:00:00

the price_total is 0

but if I do checkin and checkout:

checkin date: 2019-09-17 00:22:00
check date: 2019-09-18 12:00:00
the price_total is as I expected

controller :

public function store(Request $request)
{
    $data = new RoomTransaction();
    $ym = Carbon::now()->format('Y/m');
    $row = RoomTransaction::withTrashed()->get()->count() > 0 ? RoomTransaction::withTrashed()->get()->count() + 1 : 1;
    $no_invoice = $ym.'/INV-'.Helper::ref($row);
    $data->invoice_id = $no_invoice;
    $data->guest_id = $request->guest_id;
    $data->adult = $request->adult;
    $data->child = $request->child;
    $data->checkin_date = $request->checkin_date.' '.$request->time_checkin;
    $data->checkout_date = $request->checkout_date.' '.$request->time_checkout;
    $data->room_id = $request->room_id;
    $data->deposite= $request->deposite;
    $data->user_id = Auth::user()->id;
    $data->method = $request->method;
    $data->status = 1;
    $room_id = $data->room_id;
    $room = Room::find($room_id);

    $diff_day = $this->diffday($data->checkin_date,$data->checkout_date);

    $data->price_total = $room->roomtype->price_night * $diff_day;

    if ($data->save()) {

        $room = Room::find($room_id);
        $room->status = 1;
        $room->save();
    }
    return redirect('admin/'.$this->title)->with('success', 'Check-In Success');

}
 private function diffday($checkin,$checkout)
    {
        $checkin = date_create($checkin);
        $checkout = date_create($checkout);
        $interval = date_diff($checkin, $checkout);

       return $interval->format('%a');

    }

I am confused what logic is best for overcoming the problem

Sep
10
1 month ago
Activity icon

Started a new conversation Different Method Store

what is the difference of these two methods?

public function store(Request $request)
    {
        $validator = Validator::make($request->all(), [
            'name' => 'string',
            'username' => 'string|max:20|unique:users',
            'role_id' => 'required|string',
             'active' => 'string',
            ]);
       if ($validator->passes()) {
        $model = $request->all();
        $model['password'] = bcrypt($model['password']);
        User::create($model);
        return redirect($this->title)->with('success', 'New User Added!');
    }

and :

 public function store(Request $request)
    {
        $data = new User();
        $data->name = $request->name;
        $data->username = $request->username;
        $data->password = bcrypt($request->password);
        $data->role_id = $request->role_id;
        $data->active = $request->active;
    $data->save();
        return redirect($this->title)->with('success','New User Added!');
    }
Sep
07
1 month ago
Activity icon

Started a new conversation Logout With Message

I want to get a 'Logged Out' message after I've got logout

I tried this:

public function logout(Request $request)
    {
        Auth::logout();
        return redirect('/')->with('success','You have been logged out');
    }

login blade :

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Laravel Inventory</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
    <meta content="Coderthemes" name="author" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <!-- App favicon -->
    <link rel="shortcut icon" href="{{asset('assets/images/favicon.ico')}}">

    <!-- App css -->
    <link href="{{asset('assets/css/bootstrap.min.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{asset('assets/css/icons.min.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{asset('assets/css/app.min.css')}}" rel="stylesheet" type="text/css" />
</head>
<body class="authentication-bg authentication-bg-pattern d-flex align-items-center">
    <div class="account-pages w-100 mt-5 mb-5">
        <div class="container">
            <div class="row justify-content-center">
                <div class="col-md-8 col-lg-6 col-xl-5">
                    <div class="card">
                        <div class="card-body p-4">

                            <div class="text-center mb-4">
                                <a href="index.html">
                                    <span><img src="{{asset('assets/images/logo-login.png')}}" alt="" height="28"></span>
                                </a>
                            </div>
                            <form id="==" action="{{route('login')}}" class="pt-2" method="POST">
                                @csrf
                                <div class="form-group mb-3">
                                    <label>Username</label>
                                    <input type="text" class="form-control{{ $errors->has('username
                                    ') ? ' is-invalid' : '' }}" name="username" value="{{ old('username') }}" required autofocus placeholder="Username or Email">
                                    @if ($errors->has('username'))
                                    <div class="alert alert-light" role="alert">
                                        <strong>{{ $errors->first('username') }}</strong>
                                    </span>
                                    @endif
                                </div>
                                <div class="form-group mb-3">
                                    <label for="password">Password</label>
                                    <input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required placeholder="password">
                                    @if ($errors->has('password'))
                                    <span class="invalid-feedback">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                    @endif
                                </div>
                                <input type="hidden" name="active" value="1">
                                <div class="form-group mb-0 text-center">
                                    <button class="btn btn-success btn-block" type="submit"> Log In </button>
                                </div>
                            </form>
                            <!-- end row -->
                        </div> <!-- end card-body -->
                    </div>
                    <!-- end card -->
                </div> <!-- end col -->
            </div>
            <!-- end row -->
        </div>
        <!-- end container -->
    </div>
    <!-- end page -->
    <!-- Vendor js -->
    <script src="{{asset('assets/js/vendor.min.js')}}"></script>
    <!-- App js -->
    <script src="{{asset('assets/js/app.min.js')}}"></script>
     <!-- App js -->
        <script src="{{asset('js/bootstrap-notify.js')}}"></script>
@if ($success = Session::get('success'))
<script>
    $(document).ready(function() {
        $.notify({
            icon: 'ui icon check',
            message: "{{ $success }}"},
            {type: 'success',timer: 400}
            );
    });
</script>
@endif

@if ($error = Session::get('error'))
<script>
    $(document).ready(function() {
        $.notify({
            icon: 'ui icon times',
            message: "{{ $error }}"},
            {type: 'danger',timer: 400});
    });
</script>
@endif
</body>
</html>

But this haven't worked for me. Does anybody knows a solution? I've just want a "You have been logged out" message.

Thanks

Aug
31
1 month ago
Activity icon

Replied to Convert Query Builder To Eloquent

it works Thank you

Activity icon

Started a new conversation Convert Query Builder To Eloquent

Is there a way to transform this query builder to eloquent ?

$products = DB::select("SELECT *,
(CASE
WHEN datediff(expire_date,CURDATE()) > 0 then datediff(expire_date,CURDATE())
ELSE 'Expired'
END) as remaining from products");
Aug
16
2 months ago
Activity icon

Started a new conversation Node_modules Folder

I run the command npm install, then the node_modules folder appears.

is it okay if I delete the node_modules folder?

Aug
02
2 months ago
Activity icon

Started a new conversation Delete Minus Sign

i have code :

{{$transaction->net_total - $transaction->paid}}

example of results :

-1400000

can the minus sign be deleted?

Jul
30
2 months ago
Activity icon

Replied to Looping Data Barcode

thank you it's work

Activity icon

Started a new conversation Looping Data Barcode

i have page for barcode print by id product

like this :

https://imgur.com/RmzRLmr

i want page show 20 barcode like picture bellow

https://imgur.com/KhH3iL0

I only have 1 barcode data but I want to display as many as 20 barcodes on the page ... so, when I print a barcode, I can print as many as 20 barcodes, not just one

blade view :

<div class="row">
   <div class="col-12">
      <div class="card-box">
         <div class="header-title"> 
            <a href="#" class="btn btn-info btn-sm" onclick="printDiv('printableArea')" >
            <i class="fa fa-print"></i>
            Print
            </a>
         </div>
         <div class="panel-body" id="printableArea">
            <div class="col-md-2" style="padding: 10px; border: 1px solid #adadad;display:inline-block;line-height:16px !important; " align="center">
               <p>{{$products->name}}</p>
               <?php echo '<img src="data:image/png;base64,' . DNS1D::getBarcodePNG($products->code, "c128A",1,40,array(1,1,1), true) . '"   />'; ?>
               <br>
               <small style="font-size: 8px !important;"><b>{{$products->code}}</b></small>
               <p style="line-height: 12px !important; font-size: 8px !important;">
                  <b>Price: {{$products->sale_price}} </b>
               </p>
            </div>
         </div>
      </div>
   </div>
</div>
<script>
   function printDiv(divName) {
       var printContents = document.getElementById(divName).innerHTML;
       var originalContents = document.body.innerHTML;
       document.body.innerHTML = printContents;
       window.print();
       document.body.innerHTML = originalContents;
   }
</script>

controller :

public function barcodes($id){
    $title = $this->title; 

    $products = Product::find($id);
    $vars = compact('products');

    $data = ['products' => $products];
    return view($title.'.barcodes',compact('data','products'));
}
Activity icon

Started a new conversation Print Barcode Page

i have page for barcode print

like this :

https://imgur.com/FQEYGal

i want page show like this

https://imgur.com/IfC3McK

how to make page like picture above?

@extends('layouts.app')
@section('content')
<div class="row">
    <div class="col-12">
        <div class="page-title-box">
            <h4 class="page-title">Barcode</h4>
        </div>
    </div>
</div> 
<div class="row">
    <div class="col-12">
        <div class="card-box">
            <div class="header-title"> <a href="#" class="btn btn-info btn-sm" onclick="printDiv('printableArea')" >
                <i class="fa fa-print"></i>
                Print
            </a>
        </div>
        <div class="panel-body" id="printableArea">
            @foreach($products as $product)
            <div class="col-md-2" style="padding: 10px; border: 1px solid #adadad; " align="center">
                <p>{{$product->name}}</p>
                <?php echo '<img src="data:image/png;base64,' . DNS1D::getBarcodePNG($product->code, "c128A",1,33,array(1,1,1), true) . '"   />'; ?>
                <br>
                <small style="font-size: 8px !important;"><b>{{$product->code}}</b></small>
                <p style="line-height: 12px !important; font-size: 8px !important;">
                    <b>Price: {{$product->sale_price}} </b>
                </p>
            </div>
            @endforeach     
        </div>
    </div>
</div>
</div>
 <script>
        function printDiv(divName) {
            var printContents = document.getElementById(divName).innerHTML;
            var originalContents = document.body.innerHTML;
            document.body.innerHTML = printContents;
            window.print();
            document.body.innerHTML = originalContents;
        }
    </script>
@endsection

controller :

    public function barcode()
{
     $title = $this->title;
       $products = Product::all();
    return view($title.'.barcode',compact('products'));
}
Jul
28
2 months ago
Activity icon

Replied to Alert Quantity Product In Blade View

i'm using this in blade view

@extends('layouts.app')
@section('content')

<div class="row">
<div class="col-12">
<div class="page-title-box">
<h4 class="page-title">Data Selll</h4>
</div>
</div>
</div> 
<div class="row">
<div class="col-12">
<div class="card-box">
<form method="POST" action="{{url('sell/store')}}" enctype="multipart/form-data">
{{ csrf_field() }} 
<div class="col-sm-12">
<div class="form-row">
<div class="form-group col-md-4">
<label for="inputEmail4" class="col-form-label">Sell Date</label>
<input type="text" class="form-control" placeholder="mm/dd/yyyy"  name="sell_date" id="datepicker">
</div>
<div class="form-group col-md-4">
<label for="inputEmail4" class="col-form-label">Invoice No</label>
<input type="text" class="form-control" id="ref_no" value="{{$ref_no}}" readonly>
<input type="hidden" name="invoice_no" value="{{$ref_no}}" id="invoice_no">
<span id="errMsg" class="text-danger"></span>
</div>
<div class="form-group col-md-4">
<label for="inputEmail4" class="col-form-label">Customer</label>
<select class="form-control selectpicker" name="customer_id"  data-live-search="true" id="cus" required>
<option value="">Select Customer</option>
@foreach($customers as $key=>$value)
<option value="{{$key}}">{{$value}}</option>
@endforeach
</select>
</div>
<div class="form-group col-md-4">
<label for="inputEmail4" class="col-form-label">Product Name</label>
<input class="form-control auto" placeholder="Search Item" id="search" >
<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content" id="ui-id-2" tabindex="0" style="display: none; top: 70px; left: 10px; width: 500px;">
<li>No Item Found!</li>
</ul>
</div>
</div>
</div>

<div>
<table class="table table-bordered bg-purchase" id="purchaseInvoice">
<tbody>
<tr class="dynamicRows">
<th class="text-center">Name</th>
<th class="text-center">Unit Cost</th>
<th class="text-center">Quantity</th>
<th class="text-center">Sub Total</th>
<th class="text-center">Action</th>
</tr>
<tr class="tableInfo">
<td colspan="4" align="right"><strong>Total</strong></td>
<td align="left" colspan="2"><input type='text'  class="form-control subTotal" id="subTotal" onkeyup="sum();" readonly></td>
</tr>
<tr class="tableInfo"><td colspan="4" align="right"><strong>Paid</strong></td><td align="left" colspan="2"><input type='text'  class="form-control" id = "paidTotal" name="paid" onkeyup="sum();"></td></tr>

<tr class="tableInfo"><td colspan="4" align="right"><strong>Method</strong></td><td align="left" colspan="2">
<select name="method" id="" class="form-control">
<option value="">Select Method</option>
<option value="Cash">Cash</option>
<option value="Cash">Credit</option>
</select>
</td></tr>
<tr class="tableInfo"><td colspan="4" align="right"><strong>Due</strong></td><td align="left" colspan="2"><input type='text'  class="form-control" id = "payment_due"  readonly></td></tr>
</tbody>
</table> 
<div class="box-footer">
<button type="reset" class="btn btn-danger">Cancel</button>
<button type="submit" class="btn btn-info" id='btnSubmit'>Simpan</button>
</div>   
</div>
</form>
</div>
</div>
</div>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
<script type="text/javascript">
function in_array(search, array)
{
for (i = 0; i < array.length; i++)
{
if(array[i] ==search )
{
return true;
}
}
return false;
}

var stack = [];
$(document).keypress(function(e) {
if(e.which == 13) {
e.preventDefault();
return false;
}
});
$( "#search" ).autocomplete({
source: function(request, response) {
$.ajax({
url: '{{url('purchase/item-search')}}',
dataType: "json",
type: "get",
data: {

search: request.term
},
success: function(data){
//Start
if(data.status_no == 1){
$("#val_item").html();
var data = data.items;
$('#ui-id-2').css('display','none');
response( $.map( data, function( item ) {
return {
id: item.id,
code: item.code,
value: item.name,
unit: item.unit,
cost_price: item.cost_price,
sale_price: item.sale_price,
initial_stock: item.initial_stock,
total_stock: item.total_stock
}
}));
}else{
$('.ui-menu-item').remove();
$('.addedLi').remove();
$("#ui-id-1").append($("<li class='addedLi'>").text(data.message));
var searchVal = $("#search").val();
if(searchVal.length > 0){
$("#ui-id-2").css('display','block');
}else{
$("#ui-id-2").css('display','none');
}
}
//end
}
})
},
select: function(event, ui) {
var e = ui.item;
if(e.id) {
if(!in_array(e.id, stack))
{
stack.push(e.id);

var taxAmount = (e.sale_price*1);

var new_row = '<tr class="nr" id="rowid'+e.id+'">'+

'<td>'+ e.value +'<input type="hidden" value=""></td><input type="hidden" name="product_id[]" value="'+e.id+'"></td>'+
'<td><input min="0"  type="text" data-id = "'+e.id+'" id="rate_id_'+e.id+'" value="'+ e.sale_price +'" class="form-control text-center unitprice" name="unit_cost_price[]" ></td>'+
'<td><input class="form-control text-center no_units" data-id="'+e.id+'" data-rate="'+ e.sale_price +'" type="text" id="qty_'+e.id+'" name="quantity[]" value="1" data-tax ="'+e.rate+'">' +
'<td><input class="form-control text-center amount" type="text" id="amount_'+e.id+'" value="'+e.sale_price+'" name="sub_total[]"  readonly></td>'+

'<td class="text-center"><button id="'+e.id+'" class="btn btn-xs btn-danger delete_item"><i class="fa fa-trash"></i></button></td>'+
'</tr>';

$(new_row).insertAfter($('table tr.dynamicRows:last'));


// Calculate subtotal
var subTotal = calculateSubTotal();
$("#subTotal").val(subTotal);



$('.tableInfo').show();

} else {
$('#qty_'+e.id).val( function(i, oldval) {
return ++oldval;
});
var q = $('#qty_'+e.id).val();
var r = $("#rate_id_"+e.id).val();

$('#amount_'+e.id).val( function(i, amount) {
var itemPrice = (q * r);
return itemPrice;
});


// Calculate subTotal
var subTotal = calculateSubTotal();
$("#subTotal").val(subTotal);
// Calculate GrandTotal

}

$(this).val('');
$('#val_item').html('');
return false;
}
},
minLength: 1,
autoFocus: true
});

$(document).ready(function() {
$(window).keydown(function(event){
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
});

// price calcualtion with quantity
$(document).ready(function(){
$('.tableInfo').hide();
});


$(document).on('keyup', '.no_units', function(ev){
var id = $(this).attr("data-id");
var qty = parseInt($(this).val());

var rate = $("#rate_id_"+id).val();

var price = calculatePrice(qty,rate);       

$("#amount_"+id).val(price);

// Calculate subTotal
var subTotal = calculateSubTotal();
$("#subTotal").val(subTotal);


});

// calculate amount with unit price
$(document).on('keyup', '.unitprice', function(ev){

var unitprice = parseFloat($(this).val());

var id = $(this).attr("data-id");

var qty = $("#qty_"+id).val();
//console.log(qty);
var rate = $("#rate_id_"+id).val();

var price = calculatePrice(qty,rate);
$("#amount_"+id).val(price); 

// Calculate subTotal
var subTotal = calculateSubTotal();
$("#subTotal").val(subTotal);


});

// Delete item row
$(document).ready(function(e){
$('#purchaseInvoice').on('click', '.delete_item', function() {
var v = $(this).attr("id");
stack = jQuery.grep(stack, function(value) {
return value != v;
});

$(this).closest("tr").remove();


var amountByRow = $('#amount_'+v).val();

var subTotal = calculateSubTotal();
$("#subTotal").html(subTotal);          

});
});



/**
* Calcualte Sub Total 
*@return subTotal
*/
function calculateSubTotal (){
var subTotal = 0;
$('.amount').each(function() {
subTotal += parseInt($(this).val());
});
return subTotal;
}

function calculategrandTotal (){
var grandTotal = 0;
$('.subTotal').each(function() {
grandTotal += parseInt($(this).val());
});
return grandTotal;
}
/**
* Calcualte price
*@return price
*/
function calculatePrice (qty,rate){
var price = (qty*rate);
return price;
}   

// Item not found error
$("#search").on('keyup', function(){
var searchVal = $("#search").val();
if(searchVal.length > 0){
$("#ui-id-2").css('display','block');
}else{
$("#ui-id-2").css('display','none');
}         
});

</script>


@endsection
Activity icon

Started a new conversation Alert Quantity Product In Blade View

i have form input quantity, how to show alert on the form if the quantity of product out of stock?

Jul
15
3 months ago
Activity icon

Replied to Join 3 Table By Laravel Eloquent Model

done! I have successfully displayed the name of the supplier i made a mistake at my model

model :

 public function supplier()
    {
        return $this->belongsTo('App\Supplier', 'id','supplier_id');
    }

i change to :

 public function supplier()
    {
        return $this->belongsTo('App\Supplier', 'supplier_id','id');
    }
Activity icon

Replied to Join 3 Table By Laravel Eloquent Model

purchase from here :

class Purchase extends Model
{  
   protected $fillable = ['purchase_date','supplier_id','invoice_no','status','total','description','user_id'];

    public function supplier()
    {
        return $this->belongsTo('App\Supplier', 'id','supplier_id');
    }

     public function product()
    {
        return $this->belongsTo('App\Product');
    }

      public function purchase()
    {
        return $this->belongsTo('App\PurchaseDetail','id', 'purchase_id');
    }

i want show on blade view :

  • purchase date (from Purchase Model)
  • supplier name (from Purchase Model)// I can't get the supplier's name
  • invoice number (from Purchase Model)
  • price (from PurchaseDetail Model)
Activity icon

Started a new conversation Join 3 Table By Laravel Eloquent Model

i have 3 model :

class PurchaseDetail extends Model
{
    protected $fillable = ['purchase_id','product_id','quantity','price'];
     public function purchase()
    {
        return $this->belongsTo('App\Purchase', 'purchase_id','id');
    }

    public function product()
    {
        return $this->belongsTo('App\Product', 'product_id','id');
    }
}
class Purchase extends Model
{  
   protected $fillable = ['purchase_date','supplier_id','invoice_no','status','total','description','user_id'];

    public function supplier()
    {
        return $this->belongsTo('App\Supplier', 'id','supplier_id');
    }

     public function product()
    {
        return $this->belongsTo('App\Product');
    }
      public function purchase()
    {
        return $this->belongsTo('App\PurchaseDetail','id', 'purchase_id');
    }
class Product extends Model
{
      use SoftDeletes;
      
   protected $fillable = ['name','code','category_id','subcategory_id','details','cost_price','sale_price','initial_stock','total_stock','unit','user_id'];
    
   public function purchaseh() {
        return $this->belongsTo('App\Purchase');
    }

     public function purchased() 
     {
      return $this->hasMany('App\PurchaseDetail','id','product_id');
      }

my controller :

public function history($id) 
    {
        //
        $data = PurchaseDetail::with(['purchase'])->where('product_id', $id)->orderBy('id', 'DESC')->get();
        return view ('product.history',compact('data'));
    } 

I use this but there is an error

blade view :

 <table id="datatable5" class="table table-bordered dt-responsive nowrap">
                <thead>
                    <tr>
                        <th>Purchase Date</th>
                        <th>Inovice No</th>
                        <th>Price</th>
                        <th>Supplier</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($data as $product)
                    <tr>
                        <td>{{ $product->purchase->purchase_date }}</td>
                        <td>{{ $product->purchase->invoice_no }}</td> 
                        <td>{{ $product->price }}</td>
                         <td>{{$product->purchase->supplier->name }}</td>// from model Purchase
                    </tr>
                @endforeach
            </tbody>
        </table>

is there something wrong with my model or controller? I want to display supplier name

Jun
27
3 months ago
Activity icon

Replied to How Get Total Sum From Input Box Values Using Javascript?

@MAHAVEER - Thank you for your answer I have successfully displayed sub total values what I want is ... to display the sub-total value in the Total input box so if I add new product ... it will automatically calculate the sub total value and display it in the Total input box

Activity icon

Started a new conversation How Get Total Sum From Input Box Values Using Javascript?

I am not very familiar with javascript so i think that I need some help from you guys. I want to show sub total sum of values on input box as total.

purchase_price * qty = sub_total

i need dynamically calculate total for all sub_total amounts and show in input box

view :

                <table id="purchaseInvoice" class="table table-bordered bg-purchase">
                    <thead class="">
                        <tr>
                            <th>Product</th>
                            <th>Code</th>
                            <th>Purchase Price</th>
                            <th>Unit</th>
                            <th>Quantity</th>
                            <th>Sub Total</th>
                            <th class="center">Action</th>
                        </tr>
                    </thead>
                    <tbody >
                        <tr class="dynamicRows">
                        </tr>
                    </tbody>
                    <tfoot>
                        <tr>
            <td colspan="5" style="text-align: right; font-weight: bold;">Total</td>

    <td colspan="2"><input type="text" class="form-control text-center" id="total_subtotal" name="total" ></td>
                        </tr>
                    </tfoot>
                </table>     
            </div>
        </form>
    </div>
</div>
</div>

script :

<script>
    var stack = [];
    $(document).keypress(function(e) {
        if(e.which == 13) {
            e.preventDefault();
            return false;
        }
    });
    function in_array(search, array)
    {
        for (i = 0; i < array.length; i++)
        {
            if(array[i] ==search )
            {
                return true;
            }
        }
        return false;
    }
    $( "#kd" ).autocomplete({
        source: function(request, response) {
            $.ajax({
                url: '{{url('admin/purchase/item-search')}}',
                dataType: "json",
                type: "get",
                data: {
                    cari: request.term
                },
                success: function(data){
                    var data = data.items;
                    response( $.map( data, function( item ) {
                        return {
                            id: item.id,
                            code: item.code,
                            value: item.name,
                            unit: item.unit,
                            qty: item.qty,
                            purchase_price: item.purchase_price,
                            sell_price: item.sell_price,
                        }
                    }))
                }              
            });
        },
        select: function(event, ui){
            var e=ui.item;
            if(e.id){
                if(!in_array(e.id, stack))
                {
                    stack.push(e.id);

                    var taxAmount = (e.purchase_price*1);

                    var new_row ='<tr class="nr" id="rowid'+e.id+'">'+ 
'<td><input type=hidden name=name[] value="'+e.value+'">'+e.value+'</td>'+

'<td><input type=hidden name=id[] value="'+e.id+'"><input type=hidden name=code[] value="'+e.code+'">'+e.code+'</td>'+
'<td><input id="hb'+e.id+'" type=hidden name=purchase_price[] value="'+e.purchase_price+'">'+e.purchase_price+'</td>'+
'<td><input type=hidden name=unit[] value="'+e.unit+'">'+e.unit+'</td>'+
'<td><input id="qty'+e.id+'" data-qty="'+e.id+'" class="qty" required  class="form-control" name="qty[]" value="1"  style="width:65px;"></td>'+
'<td><input data-qty="'+e.id+'" id="amount_'+e.id+'" name="sub_total[]" type="text" value="'+taxAmount+'" /></td>'+
'<td><span class="btn btn-danger js-submit-confirm delete_item" id='+e.id+'> <i class="fa fa-trash"></i></span</td>'+
                    '</tr>'
                    ;
                    $(new_row).insertAfter($('table tr.dynamicRows:last'));

                    $('#qty'+e.id).focus();
                }
                else
                {
                    $('#qty'+e.id).val( function(i, oldval) {
                        return ++oldval;
                    });
                    var q = $("#qty"+e.id).val();
                    var r = $("#hb"+e.id).val();
                    $('#amount_'+e.id).val( function(i, amount) {
                        var itemPrice = (q * r);
                        return itemPrice;
                    });
                }
            }
        }
    });
    $(document).ready(function(e){
        $('#purchaseInvoice').on('click', '.delete_item', function() {
            var v = $(this).attr("id");
            $(this).closest("tr").remove();
        });
    });
    $(document).ready(function(e){
        $('#purchaseInvoice').on('change keyup blur', '.qty', function() {
            var id = $(this).attr("data-qty");
            var qty = $("#qty"+id).val();
            var price = $("#hb"+id).val();
            $('#amount_'+id).val(qty*price);
        });
    });
</script>
May
18
4 months ago
Activity icon

Replied to Stream_socket_sendto(): Connection Refused

check your upload max file size

May
13
5 months ago
Activity icon

Replied to PRINT PDF, HTML To DomPdf

@EMFINANGA - done!! i have sent email.

Activity icon

Replied to PRINT PDF, HTML To DomPdf

@EMFINANGA - i don't have TeamViewer on my pc...sent me your app files through email

Activity icon

Replied to PRINT PDF, HTML To DomPdf

@EMFINANGA - you may have to be validate the pdf file....

i'm use this for download pdf file :

   public function cetak_invoice($id)
    {

        $title = $this->title;
        $transaksi = TransaksiKamar::with('kamar','tamu')->find($id);
        $layanan = TransaksiLayanan::where('transaksi_kamar_id',$transaksi->id)->get();
        $perusahaan = Perusahaan::all();
        $pdf = PDF::loadView('admin.'.$title.'.invoice',compact('title','transaksi','jumlah_hari','layanan','perusahaan'));
         return $pdf->stream();

    }
May
12
5 months ago
Activity icon

Replied to Database Query

example :

$data = Room::with('roomtypes','floors')->where('status',0)->orderBy('room_number')->get();

Activity icon

Replied to Laravel 5.8 Foreign Key

for example :

 public function store(Request $request)
    {
          $this->validate($request,[
            'test' => 'integer|min:1',
          
        ]);

       $input = $request->all();
       $input['user_id'] = Auth::user()->id;

Test::create($input);
    Alert::success('Success');
      }else{
            Alert::error('Error');

      }
    
        return Redirect::to('admin/'.$this->title);
    }
Activity icon

Replied to How To Show Image In View When Upload?

try this :

view :

<div id="dropzone" class="box-body">
  <form method="POST" action="{{url('admin/gallery/store')}}" class="dropzone" id="gallery-dropzone" files="true" enctype="multipart/form-data">
     {{csrf_field()}}
  
  </form>
    <p>Upload File: jpg, jpeg, png</p>
  </div>

js :

<script>
          $(function () {
 Dropzone.options.galleryDropzone = {
          paramName: "gallery_img",
          maxFilesize: 20, // MB
          acceptedFiles: ".jpeg,.jpg,.png,.gif",
          };

          });
</script>
Activity icon

Replied to Uploading A File Error

'cv' => 'file|mimes:docx|max:2048',
Activity icon

Replied to PRINT PDF, HTML To DomPdf

@EMFINANGA - try this

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>test</title>

    <style type="text/css">
        @page {
            margin: 0px;
        }
        body {
            margin: 0px;
        }
        * {
            font-family: Verdana, Arial, sans-serif;
        }
        a {
            color: #fff;
            text-decoration: none;
        }
        #customers {
            font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
            border-collapse: collapse;
            width: 100%;
            font-size:12px;
        }
        #customers td, #customers th {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: center;
        }

        tfoot tr td {
            font-weight: bold;
            font-size:12px;
        }
        .invoice table {
            margin: 15px;
        }
        .invoice h3 {
            margin-left: 15px;
        }
        .information {
            background-color: #60A7A6;
            color: #FFF;
            font-size:12px;
        }
        .information .logo {
            margin: 5px;
        }
        .information table {
            padding: 10px;
        }
    </style>

</head>
<body>

    <div class="information">
        <table width="100%">
            <tr>
                <td align="left" style="width: 40%;">
                    <h3>name</h3>
                    <pre>
                        testttt
                        <br /><br />
                        test
                    </pre>

                </td>
                <td align="center">
                    <img src="backend/images/default.jpg" alt="Logo" width="70" class="logo"/>
                </td>
                <td align="right" style="width: 40%;">

                    <h3></h3>
                    <pre>
                        sajfkaskjfas
                    </pre>

                </td>
            </tr>

        </table>
    </div>




    <div class="invoice" style="overflow-x:auto;">
        <h4 align="center" style="font-size: 12px;">testtttt</h4>
        <table id="customers">
            <thead>
                <tr>
                    <th>Keterangan Layanan / Produk</th>
                    <th class="text-center">Harga</th>
                    <th class="text-center">Qty</th>
                    <th class="text-center">Total</th>
                </tr>
            </thead>
            <tbody>
                <tr>

                </tr>

                <tr>

                </tr>


            </tbody>

            <tfoot>
                <tr>
                    <td colspan="2"></td>
                    <td align="left">Sub Total</td>
                    <td align="left" class="gray"></td>
                </tr>
                <tr>
                    <td colspan="2"></td>
                    <td align="left">Grand Total</td>

                    <td align="left" class="gray"></td>
                </tr>
            </tfoot>
        </table>
    </div>

    <div class="information" style="position: absolute; bottom: 0;">
        <table width="100%">
            <tr>
                <td align="left" style="width: 50%;">
                    &copy; {{ date('Y') }} {{ config('app.url') }} - All rights reserved.
                </td>
                <td align="right" style="width: 50%;">
                    Company Slogan
                </td>
            </tr>

        </table>
    </div>
</body>
</html>
May
11
5 months ago
May
09
5 months ago
Activity icon

Replied to HOW TO PERFORM SOME CALCULATION ON THE VIEW PAGE

try this :

<?php $closed_balance = $totalAmount  - $totalExpense ; ?>
<td align="left" class="gray">{{number_format($closed_balance,2)}}</td>