bekaskaki

bekaskaki

Member Since 3 Months Ago

indonesia

Experience Points 2,340
Experience Level 1

2,660 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 2
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

18 May
1 month ago

bekaskaki left a reply on Stream_socket_sendto(): Connection Refused

check your upload max file size

13 May
1 month ago

bekaskaki left a reply on PRINT PDF, HTML To DomPdf

@EMFINANGA - done!! i have sent email

bekaskaki left a reply on PRINT PDF, HTML To DomPdf

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

bekaskaki left a reply on 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();

    }
12 May
1 month ago

bekaskaki left a reply on Database Query

example :

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

bekaskaki left a reply on 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);
    }

bekaskaki left a reply on 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",
          };

          });

bekaskaki left a reply on Uploading A File Error

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

bekaskaki left a reply on 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>
09 May
1 month ago

bekaskaki left a reply on 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>
28 Apr
1 month ago

bekaskaki started a new conversation Query Show Data By Date And Status

db table :

 `user_id` 
  `invoice_id`
  `guest_id`
  `room_id`
  `checkin_date` 
  `checkout_date` 
  `total_price` 
  `deposit` 
  `status` //default value 0

how to query to display data by checkout_date = current date and status value 0?

i use code below but I am confused to add a status value of 0 :

 $guest_checkout = RoomTransaction::whereDate('checkout_date', Carbon::today())->get();

bekaskaki left a reply on If Condition Blade View

Thank you @neeonline and @snapey , I've tried two codes that you suggest, both of them works

bekaskaki left a reply on How To Use Sweet Alerts In Laravel

@LUDO1960 - i use this for delete confirmation using sweet alert

 <form class="form-horizontal" method="POST" action="{{url('admin/'.$title.'/'.$dt->id) }}" enctype="multipart/form-data">
              {{ csrf_field() }}
              <input name="_method" type="hidden" value="DELETE">
             
              <a class="js-submit-confirm">
                <i class="fa fa-trash">delete</i>
              </a>
            </form> 

script :

 $(document.body).on('click', '.js-submit-confirm', function (event) {
        event.preventDefault();
        var $form = $(this).closest('form');
        swal({
            title: "Are you sure?",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes",
            closeOnConfirm: true
        },
                function () {
                    $form.submit();
                });
      });

bekaskaki left a reply on If Condition Blade View

@SNAPEY - I changed the value in the database

I have 3 values ​​in the status column 1 = used 2 = dirty 0 = available

i want show in view, Kamar with status 2, if there are no Kamar with status 2, it will display this :

@else
<div class="alert alert-warning">
<h4>Mohon Maaf</h4>
Untuk sementara, tidak ada kamar yang sedang kotor.
</div>
@endif

bekaskaki left a reply on If Condition Blade View

@NEEONLINE - I have tried the code you provided, but it still doesn't work

if and else section appear both

27 Apr
1 month ago

bekaskaki left a reply on If Condition Blade View

@PATRICKADVANCE - I have tried the code you provided, but it still doesn't work

controller :

 public function create()
    {
        $title = $this->title;
        $kamar = Kamar::with('typekamar')->where('status',2)->get();
        return view('admin.'.$title.'.create',compact('title','kamar'));
    }

full view :

@extends('admin.layouts.app')
@section('content')
<section class="content">
<div class="box">
<div class="box-body">          
<div class="row">
    
@foreach($kamar as $room)
@if ($room->status == '2')
<div class="col-sm-3">
<div class="small-box bg-yellow">
<div class="inner">
<h3>{{$room->nomor_kamar}}</h3>
<p>{{$room->typekamar->nama}}</p>
</div>
<div class="icon">
<i class="fa fa-bed"></i>
</div>
<a class="small-box-footer" href="" action="">Bersihkan</a>
</div>
</div>

@else
<div class="alert alert-warning">
<h4>Mohon Maaf</h4>
Untuk sementara, tidak ada kamar yang sedang kotor.
</div>
@endif
@endforeach

            </div>  
        </div>
    </div>
</section>
@endsection

bekaskaki left a reply on Querying Relationship Existence

@ZASTER - try this :

$sub_jobs = $sub_jobs::with('dispatches')->get();

bekaskaki started a new conversation If Condition Blade View

view :

@foreach($kamar as $room)
@if ($room->status === '2')
<div class="col-sm-3">
<div class="small-box bg-yellow">
<div class="inner">
<h3>{{$room->nomor_kamar}}</h3>
<p>{{$room->typekamar->nama}}</p>
</div>
<div class="icon">
<i class="fa fa-bed"></i>
</div>
<a class="small-box-footer" href="" action="">Bersihkan</a>
</div>
</div>

@else
<div class="alert alert-warning">
<h4>Mohon Maaf</h4>
Untuk sementara, tidak ada kamar yang sedang kotor.
</div>
@endif
@endforeach

controller :

 public function create()
    {
        $title = $this->title;
        $kamar = Kamar::with('typekamar')->where('status',2)->get();
        return view('admin.'.$title.'.create',compact('title','kamar'));
    }

I use if condition, but when I change status '0' in table, else section doesn't appear

bekaskaki left a reply on Sum Total Price

@PUNKSOLID - it's work...i change model and controller like you suggest

thank you

bekaskaki left a reply on Sum Total Price

@PUNKSOLID - i use servicecategories to display:

<div class="row">
@foreach($service as $servicess)
<div class="col-sm-3">
<a href="" class="btn btn-lg btn-block btn-primary" data-toggle="modal" data-target="#tambah-data{{$servicess->id}}">{{$servicess->kategori_namei}}</a>
</div>
@endforeach

and service to display :

<div class="modal-body">
 <table class="table table-striped table-hover" id="purchaseInvoice">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
<th>Qty</th>
</tr>
</thead>
<tbody>

@foreach($services as $services)
@if ($services->layanan_kategori_id == $servicess->id)
<tr>
<td> <input type="hidden" name="service_id" value="{{$services->id}}">{{$services->name}}</td>

<td><input class="form-control" type="text" name="price" id="hb" value="{{$services->price}}"></td>
<td>
    <div class="row">
<div class="col-sm-4">
    <input type="text" class="form-control" name="qty" id="qty">
    <input class="form-control" type="text" name="total" id="amount_">
    </div>
    <div class="col-sm-8">
                                                                    
    </div>

bekaskaki left a reply on Sum Total Price

@PUNKSOLID - i'm trying to save data saving ok but displaying data wrong

$service->price = Service::find($input['price'])->price;  // from another table  

show controller :

  public function show($id)
    {
        $title = $this->title ;
        $guest = RoomTransaction::with('room','guest')->find($id);
        $Service = ServiceCategori::all();
        $Services = Service::all(); //price from here
      
        return view('admin.'.$title.'.edit',compact('title','guest','Service','Services'));
    }

here is field in ServiceTransaction table :

`user_id` int(11) NOT NULL,
  `room_transaction_id` int(11) NOT NULL,
  `service_id` int(11) NOT NULL,
  `qty` int(11) NOT NULL,
  `total` int(11) NOT NULL,

bekaskaki started a new conversation Sum Total Price

my controller :

public function store(Request $request)
    {
        $input = $request->all();
        $input['service_id'] = $request->service_id;
        $input['qty'] = $request->qty;
        $input['user_id'] = Auth::user()->id;
        $input['price'] = Service::find($input['price']);
        $total =  $input['price'] * $input['qty'];
        $input['total'] = $total;
        if (ServiceTransaction::create($input)){
            Alert::success('Successfully Updated', 'Success');
        }else{
             Alert::error('Something went wrong!', 'Oops...');
        }
        return Redirect::to('admin/'.$this->title);
    }

model :

class ServiceTransaction extends Model
{

    public function service(){
        return $this->hasOne('App\Layanan','id','layanan_id');
}

view :


 <div class="modal-body">
                <table class="table table-striped table-hover" id="purchaseInvoice">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Price</th>
                            <th>Qty</th>
                        </tr>
                    </thead>
                    <tbody>
                        
                        @foreach($layanans as $services)
                         @if ($services->layanan_kategori_id == $service->id)
                        <tr>
                            <td> <input type="hidden" name="service_id" value="{{$services->id}}">{{$services->name}}</td>
                            <td><input class="form-control" type="text" name="price" id="hb" value="{{$services->price}}"></td>
                            <td>
                                <div class="row">
                                    <div class="col-sm-4">
                                        <input type="text" class="form-control" name="qty" id="qty">
                                        <input class="form-control" type="text" name="total" id="amount_">
                                    </div>
                                    <div class="col-sm-8">
                                                                    
                                    </div>
                                </div>
                            </td>
                        </tr>
                         @endif
                        @endforeach     
                    </tbody>
                </table>

how to calculate the total price? I use bagaimana cara menghitung harga total? saya menggunakan $total = $input['price'] * $input['qty']; but it didn't work

10 Apr
2 months ago

bekaskaki left a reply on Can't Import Data Into Date Format

@VANDAN - if you use maatwebsite package for impor data, this is an example :

return new user([
        'UserName'           => $row['UserName'],
        'Password'           => $row['Password'],
        'date'               => \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row['date']),
    ]);

bekaskaki left a reply on Can't Import Data Into Date Format

@VANDAN - do you use the maatwebsite package?

if you use please see :

https://github.com/Maatwebsite/Laravel-Excel/issues/1832

08 Apr
2 months ago

bekaskaki left a reply on User Email Verification

@VANDAN - thanks for reply...

my question is I have an 'active' field in the database with default value 0, how, when a user clicks on email activation the number 0 changes to number 1

bekaskaki started a new conversation User Email Verification

i have db :

  $table->string('name');
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->string('active')->default(0);

Registercontroller :

  protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => ['required', 'string', 'max:255'],
            'level' => ['required', 'string', 'max:255'],
          'username' => ['required', 'string', 'max:255'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            'password' => ['required', 'string', 'min:8', 'confirmed'],
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return \App\User
     */
    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
             'level' => $data['level'],
              'username' => $data['level'],
            'email' => $data['email'],
            'password' => Hash::make($data['password']),
        ]);
    }

     public function register(Request $request)
    {
        $this->validator($request->all())->validate();

        event(new Registered($user = $this->create($request->all())));

        return redirect()->back()->with('message', 'We sent you an activation code, Check your email and click on the link to verify');
    }

how to make, when a user clicks on email activation, the 'active' field in the database changes to 1 ?

27 Mar
2 months ago

bekaskaki started a new conversation Query Count Total Revenue

i have model :

class Appointment extends Model
{
    protected $fillable = [
      'user_id',
      'vehicle_types_id',
      'washing_plan_id',
      'status_id',
      'appointment_date',
    ];

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

    public function vehicle_type() {
      return $this->belongsTo('App\Model\Vehicle_type', 'vehicle_types_id');
    }

    public function washing_plan() {
      return $this->belongsTo('App\Model\Washing_plan');
    }

    public function status() {
      return $this->belongsTo('App\Model\Status');
    }

    ```

model price :

class Washing_price extends Model { protected $fillable = [ 'washing_plan_id', 'vehicle_type_id', 'price', 'duration', ];

public function washing_plan() {
  return $this->belongsTo('App\Model\Washing_plan');
}

public function vehicle_type() {
  return $this->belongsTo('App\Model\Vehicle_type');
}

}


model Plan :

class Washing_plan extends Model { // protected $fillable = [ 'name', ];

public function washing_price(){
  return $this->hasOne('App\Model\Washing_price');
}

public function appointment() {
  return $this->hasOne('App\Model\Appointment');
}

}


model type :

class Vehicle_type extends Model { protected $fillable = [ 'icon', 'type', ];

public function washing_price(){
  return $this->hasOne('App\Model\Washing_price');
}

public function appointment() {
  return $this->hasOne('App\Model\Appointment');
}

}


I use this to display prices in the appointment view :

@foreach ($washing_prices as $washing_price) @if ($washing_price->washing_plan_id == $dt->washing_plan_id && $washing_price->vehicle_type_id == $dt->vehicle_types_id) ${{number_format($washing_price->price)}} @endif @endforeach


how to calculate total revenue based on status_id?

bekaskaki left a reply on How To Add Admin User In My Application

create field role or level on your table

example :

`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `sex` char(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `date_birthday` date DEFAULT NULL,
  `phone` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `address` text COLLATE utf8mb4_unicode_ci,
  `role` char(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
23 Mar
3 months ago

bekaskaki left a reply on HowTo? Create Entity For Users And Editable In Adminpanel?

yes, you can create another controllers in admin folder. i do the same thing

22 Mar
3 months ago

bekaskaki left a reply on Undefined Variabel

@DAVIDLI - thank you!! i'm forget to define variable on array section

i change in else section :

else{

        $password = bcrypt($request->password);

        $user = User::create(['name'=>$request->name, 'email'=>$request->email, 'password'=>$password, 'sex'=>$request->sex, 'date_birthday'=>$request->date_birthday, 'username'=>$request->username, 'phone'=>$request->phone, 'role'=>$request->role]);

        $input = $request->except(['username','name', 'email', 'password', 'sex', 'date_birthday', 'phone', 'role']);

        $input['user_id'] = $user->id;


        $washing_plan = Washing_plan::findOrFail($input['washing_plan_id'])->name;
        $vehicle_company = Vehicle_company::findOrFail($input['vehicle_company_id'])->vehicle_company;
        $vehicle_modal = Vehicle_modal::findOrFail($input['vehicle_modal_id'])->vehicle_modal;
        $vehicle_type = Vehicle_type::findOrFail($input['vehicle_types_id'])->type;
        $appointment_date = $input['appointment_date'];
        $time_frame = $input['time_frame'];


        $input['appointment_date'] = date("Y/m/d", strtotime($request->appointment_date));

        $new = Appointment::create($input);

        $user = User::findOrFail($input['user_id']);

        $user->appointment()->save($new);

        if (config('mail.username') == '' && config('mail.password') == '') {
          if (Auth::attempt(['username' => $request->username, 'password' => $request->password], $request->remember_token )) {
            Alert::success('Your Appointment Has Been Booked', 'Success');
              return back();
          }
        }

        $data = array(
          'name' => $user->name,
          'email' => $user->email,
          'washing_plan' => $washing_plan,
          'vehicle_company' => $vehicle_company,
          'vehicle_modal' => $vehicle_modal,
          'vehicle_type' => $vehicle_type,
          'date' => $appointment_date,
          'time_frame' => $time_frame,
        );

it's work!!

21 Mar
3 months ago

bekaskaki started a new conversation Undefined Variabel

controller :

 public function store(Request $request)
    {
       if (Auth::check()) {

        $input = $request->all();
      
        $user_name = User::findOrFail($input['user_id'])->name;
        $user_email = User::findOrFail($input['user_id'])->email;
        $washing_plan = Washing_plan::findOrFail($input['washing_plan_id'])->name;
        $vehicle_company = Vehicle_company::findOrFail($input['vehicle_company_id'])->vehicle_company;
        $vehicle_modal = Vehicle_modal::findOrFail($input['vehicle_modal_id'])->vehicle_modal;
        $vehicle_type = Vehicle_type::findOrFail($input['vehicle_types_id'])->type;
        $appointment_date = $input['appointment_date'];
        $time_frame = $input['time_frame'];

        $input['appointment_date'] = date("Y/m/d", strtotime($request->appointment_date));

        $new = Appointment::create($input);

        $user = User::findOrFail(Auth::user()->id);

        $user->appointment()->save($new);

        if (config('mail.username') == '' && config('mail.password') == '') {
           
          return back()->with('added', 'Your Appointment Has Been Booked');
        }

        $data = array(
         
          'name' => $user_name,
          'email' => $user_email,
          'washing_plan' => $washing_plan,
          'vehicle_company' => $vehicle_company,
          'vehicle_modal' => $vehicle_modal,
          'vehicle_type' => $vehicle_type,
          'date' => $appointment_date,
          'time_frame' => $time_frame,
        );

        Mail::send('emails.home_appointment_emails', compact('data'), function($message) use ($data){
          $message->from(config('mail.username'));
          $message->to($data['email']);
        });

        Mail::send('emails.home_appointment_emails', compact('data'), function($message) use ($data){
          $message->to(config('mail.username'));
        });
        Alert::success('Your Appointment Has Been Booked With Email', 'Success');
        return back();

      }

      else{

        $password = bcrypt($request->password);

        $user = User::create(['name'=>$request->name, 'email'=>$request->email, 'password'=>$password, 'sex'=>$request->sex, 'date_birthday'=>$request->date_birthday, 'username'=>$request->username, 'phone'=>$request->phone, 'role'=>$request->role]);

        $input = $request->except(['username','name', 'email', 'password', 'sex', 'date_birthday', 'phone', 'role']);

        $input['user_id'] = $user->id;

        $input['appointment_date'] = date("Y/m/d", strtotime($request->appointment_date));

        $new = Appointment::create($input);

        $user = User::findOrFail($input['user_id']);

        $user->appointment()->save($new);

        if (config('mail.username') == '' && config('mail.password') == '') {
          if (Auth::attempt(['username' => $request->username, 'password' => $request->password], $request->remember_token )) {
            Alert::success('Your Appointment Has Been Booked', 'Success');
              return back();
          }
        }

        $data = array(
          'name' => $user_name,
          'email' => $user_email,
          'washing_plan' => $washing_plan,
          'vehicle_company' => $vehicle_company,
          'vehicle_modal' => $vehicle_modal,
          'vehicle_type' => $vehicle_type,
          'date' => $appointment_date,
          'time_frame' => $time_frame,
        );

        Mail::send('emails.home_appointment_emails', compact('data'), function($message) use ($data){
          $message->from(config('mail.username'));
          $message->to($data['email']);
        });

        Mail::send('emails.home_appointment_emails', compact('data'), function($message) use ($data){
          $message->to(config('mail.username'));
        });

        if (Auth::attempt(['username' => $request->username, 'password' => $request->password], $request->remember_token )) {
             Alert::success('Your Appointment Has Been Booked With Email', 'Success');
            return back();
        }
      }
    }

I was making an appointment application but got a problem. when a user logs in, the user can book, but when the user not logged in, when doing a book, there is an error. error occurs in the second part of the array data "Undefined variable: user_name"

  $data = array(
         
          'name' => $user_name,
          'email' => $user_email,
          'washing_plan' => $washing_plan,
          'vehicle_company' => $vehicle_company,
          'vehicle_modal' => $vehicle_modal,
          'vehicle_type' => $vehicle_type,
          'date' => $appointment_date,
          'time_frame' => $time_frame,
        );
20 Mar
3 months ago

bekaskaki left a reply on Address In Mailbox Given [] Does Not Comply With RFC 2822, 3.6.2.

@CRONIX - thank you!!

i use :

Mail::send('emails.contact_mail', compact('data'), function($message) use ($data){
          $message->from($data['email']);
          $message->to(config('mail.username'));
          $message->subject($data['subject']);
        });

it's work

bekaskaki started a new conversation Address In Mailbox Given [] Does Not Comply With RFC 2822, 3.6.2.

my controller :

  public function send(Request $request)
    {
        $this->validate($request, [
          'name'=>'required',
          'email'=>'required|email',
          'subject'=>'required',
          'mail_message'=>'required|min:10',
        ]);

        $data = array(
          'name' => $request->name,
          'email' => $request->email,
          'subject' => $request->subject,
          'mail_message' => $request->mail_message,
        );

        Mail::send('emails.contact_mail', compact('data'), function($message) use ($data){
          $message->from($data['email']);
          $message->to(env('MAIL_USERNAME'));
          $message->subject($data['subject']);
        });
          
        Alert::success('Email Send Successfully', 'Success');
        return Redirect::to('/contact');
    }

env :

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=*********
MAIL_ENCRYPTION=tls

I'm testing sending a mail to myself using gmail driver but I'm getting the following error:

Address in mailbox given [] does not comply with RFC 2822,3.6.2.

Any idea what could be wrong?

16 Mar
3 months ago

bekaskaki left a reply on Update Password And Image Issue

done!!

i change controller like this :

public function update(Request $request)
    {

    $model = $request->all();


        $boat=User::find($model['id']); 

   

    $boat->fill($request->except('photo'));
    if($file = $request->hasFile('photo')) {
     $fullPath = public_path("images/{$boat->photo}");
    if (File::exists($fullPath))  {
       File::delete($fullPath);
    }
    $file = $request->file('photo') ;
    $fileName = $file->getClientOriginalName();
   $destinationPath = public_path().'/images/' ;
    $file->move($destinationPath,$fileName);
    $boat->photo = $fileName ;
}
    $boat['password'] = bcrypt($boat['password']);

     if($boat->save()){   
            Alert::success('Successfully Updated', 'Success');
        }else{
            Alert::error('Something went wrong!', 'Oops...');
        }
        return Redirect::to('admin/'.$this->title);
    }

bekaskaki started a new conversation Update Password And Image Issue

Controller :

 public function update(Request $request)
    {

    $model = $request->all();
    $boat=User::find($model['id']); 

    $boat['password'] = bcrypt($boat['password']);
    
    $boat->fill($request->except('photo'));
    if($file = $request->hasFile('photo')) {
     $fullPath = public_path("images/{$boat->photo}");
    if (File::exists($fullPath))  {
       File::delete($fullPath);
    }
    $file = $request->file('photo') ;
    $fileName = $file->getClientOriginalName() ;
    $destinationPath = public_path().'images/' ;
    $file->move($destinationPath,$fileName);
    $boat->photo = $fileName ;
}
     if($boat->save()){   
            Alert::success('Successfully Updated', 'Success');
        }else{
            Alert::error('Something went wrong!', 'Oops...');
        }
        return Redirect::to('admin/'.$this->title);
    }

if I use $boat->save, the image is saved but the password is not encrypted when I use an $boat->update, the password is encrypted, the image is not saved why does it happen?

15 Mar
3 months ago

bekaskaki left a reply on Error Messages In Request Validation

i have @include('flash-message') in app.blade and i removed it. it's done!! thank you

bekaskaki started a new conversation Error Messages In Request Validation

view :

@if ($errors->any())
   <div class="alert alert-danger">
      <ul>
           @foreach ($errors->all() as $error)
               <li>{{ $error }}</li>
           @endforeach
      </ul>
   </div>
@endif
<div class="box-body">
<div class="form-group-sm">
    <label for="inputEmail3" class="col-sm-3 control-label">Username</label>
    <div class="col-sm-9">
        <input type="text" class="form-control" placeholder="username" name="username" required="">
    </div>
    
</div>
<div class="form-group-sm">
    <label for="inputEmail3" class="col-sm-3 control-label">Name</label>
    <div class="col-sm-9">
        <input type="text" class="form-control" placeholder="Name" name="name">
    </div>
   
</div>
<div class="form-group-sm">
    <label for="inputPassword3" class="col-sm-3 control-label">E-Mail</label>
    <div class="col-sm-9">
        <input type="email" class="form-control" placeholder="E-Mail" name="email">
    </div>
   
</div>
<div class="form-group-sm">
    <label for="inputPassword3" class="col-sm-3 control-label">Phone</label>
    <div class="col-sm-9">
        <input type="text" class="form-control" placeholder="Phone" name="phone">
    </div>
</div>

error result :

https://prnt.sc/myde68

why error messages in Request Validation showing like that (see image) ?

12 Mar
3 months ago

bekaskaki left a reply on Where Are You All From?

indonesia,yogyakarta

11 Mar
3 months ago

bekaskaki left a reply on Show Data By Year

@TRAY2 - view :

<tr>
    <th>#</th>
    <th>Name</th>
    <th>2019</th>
    <th>2020</th>
    <th>2021</th>
</tr>
@foreach($data as $key => $jj)
<tr>
    <td>{{$key+1}}</td>
    <td>{{$jj->test1}}</td>
    <td>{{$jj->year == 2019 ? $jj->desk : ''}} </td>
    <td>{{$jj->year == 2020 ? $jj->desk : ''}} </td>
    <td>{{$jj->year == 2021 ? $jj->desk : ''}} </td>
</tr>
@endforeach

it works,,but I want to retrieve data for 2019 </ th> from YEAR (start_date) AS Year. what should i change? so,I don't need to enter the year manually

10 Mar
3 months ago

bekaskaki left a reply on Show Data By Year

@TRAY2 - i want display data like this

http://prntscr.com/mvyh9s

09 Mar
3 months ago

bekaskaki started a new conversation Show Data By Year

How can I show data by year. If year=2019 its need to show only 2019 data

I have query like this :

''' $datatest = Testing::select('test1', DB::raw('count(test2) as desk'),DB::raw("YEAR(date) as year")) ->groupBy(DB::raw("year(date)"),'test1','test2') ->get(); '''

I want to display data in table like this :

Name | year(data date) data test1 . data count test2

https://prntscr.com/mvogs6

Thanks in advance :)

08 Mar
3 months ago

bekaskaki left a reply on How To Set Login FORM Alert Message

@D9705996 - Thank you! successfully

bekaskaki started a new conversation How To Set Login FORM Alert Message

I would like to have alert come up when a user non active try logins but I can't find where the logic.

login blade :

'''

@csrf
                @if ($errors->has('username'))
                <span class="invalid-feedback">
                    <strong>{{ $errors->first('username') }}</strong>
                </span>
                @endif
                <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <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
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>

'''

Login controller :

''' class LoginController extends Controller {

use AuthenticatesUsers;

/**
 * Where to redirect users after login.
 *
 * @var string
 */
protected $redirectTo = '/';

/**
 * Create a new controller instance.
 *
 * @return void
 */
public function __construct()
{
    $this->middleware('guest')->except('logout');
}

 public function username()
{
   $login = request()->input('email');
   $field = filter_var($login, FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
   request()->merge([$field => $login]);
   return $field;
}

   protected function credentials(Request $request)

    {   

        return ['username' => $request->{$this->username()}, 'password' => $request->password, 'active' => 1];
        
    }

} '''

any can help?

06 Mar
3 months ago

bekaskaki left a reply on Unable To Render BarChart Using Lavacharts

@CRONIX - The problem is in the charts package thanks for the help