Fajar

Fajar

Member Since 2 Years Ago

Bekasi

Experience Points
4,330
Total
Experience

670 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
1
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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,330 XP
May
19
5 days ago
Activity icon

Replied to Get Data From Created_at

@michaloravec hank you for your answer

Activity icon

Started a new Conversation Get Data From Created_at

hello, how to retrieve data based on created_at

if i try my code

$penjualans = OrderDetail::whereBetween('created_at', [request('dari_tgl'), request('sampai_tgl')])
                ->get();

I did not get results, because 'dari_tgl' and 'sampai_tgl' only contained '2020-05-19' while created_at contains '2020-05-19 12:34:07'

and the input type format in html is only datetime-local which contains date and time minutes, second it is not available

thx for your help

May
18
6 days ago
Activity icon

Awarded Best Reply on How Cant I Embed An Html Video In Css Background

@tomasosho

maybe this can help

if you use laravel add to sass

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial;
  font-size: 17px;
}

#myVideo {
  position: fixed;
  right: 0;
  bottom: 0;
  min-width: 100%; 
  min-height: 100%;
}

.content {
  position: fixed;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  color: #f1f1f1;
  width: 100%;
  padding: 20px;
}

#myBtn {
  width: 200px;
  font-size: 18px;
  padding: 10px;
  border: none;
  background: #000;
  color: #fff;
  cursor: pointer;
}

#myBtn:hover {
  background: #ddd;
  color: black;
}

and run npm run dev

but if you don't use

add to css

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial;
  font-size: 17px;
}

#myVideo {
  position: fixed;
  right: 0;
  bottom: 0;
  min-width: 100%; 
  min-height: 100%;
}

.content {
  position: fixed;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  color: #f1f1f1;
  width: 100%;
  padding: 20px;
}

#myBtn {
  width: 200px;
  font-size: 18px;
  padding: 10px;
  border: none;
  background: #000;
  color: #fff;
  cursor: pointer;
}

#myBtn:hover {
  background: #ddd;
  color: black;
}

html

<video autoplay muted loop id="myVideo">
  <source src="xample.mp4" type="video/mp4">
</video>

<div class="content">
  <h1>Heading</h1>
  <p>Lorem ipsum dolor sit amet, an his etiam torquatos. Tollit soleat phaedrum te duo, eum cu recteque expetendis neglegentur. Cu mentitum maiestatis persequeris pro, pri ponderum tractatos ei. Id qui nemore latine molestiae, ad mutat oblique delicatissimi pro.</p>
  <button id="myBtn" onclick="myFunction()">Pause</button>
</div>
Activity icon

Replied to How To Count Subtotal

@michaloravec

thank you for your answer

Activity icon

Started a new Conversation How To Count Subtotal

hey how i can get subtotal from price

this my controller

$penjualans = OrderDetail::where('penjualan_id', [request('no_penjualan')])->get();

in my blade

			<tbody>
                            @forelse($penjualans as $laporanpenjualan)
                                <tr>
                                    <td>{{$laporanpenjualan->penjualan->invoice}}</td>
                                    <td>{{$laporanpenjualan->penjualan->customer_name}}</td>
                                    <td>{{$laporanpenjualan->product->nama_barang}}</td>
                                    <td>Rp.{{number_format($laporanpenjualan->price, 2)}}</td>
                                    <td>{{$laporanpenjualan->qty}}</td>
                                    <td>{{$laporanpenjualan->created_at->format('Y-m-d')}}</td>
                                    <td>{{$laporanpenjualan->penjualan->customer_address}}</td>
                                </tr>
                            @empty
                                <tr>
                                    <td colspan="7" class="text-center">
                                        <h3>Maaf laporan tidak ada</h3>
                                    </td>
                                </tr>
                            @endforelse
                        </tbody>
```

thx for your help
Activity icon

Replied to How Cant I Embed An Html Video In Css Background

@tomasosho

maybe this can help

if you use laravel add to sass

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial;
  font-size: 17px;
}

#myVideo {
  position: fixed;
  right: 0;
  bottom: 0;
  min-width: 100%; 
  min-height: 100%;
}

.content {
  position: fixed;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  color: #f1f1f1;
  width: 100%;
  padding: 20px;
}

#myBtn {
  width: 200px;
  font-size: 18px;
  padding: 10px;
  border: none;
  background: #000;
  color: #fff;
  cursor: pointer;
}

#myBtn:hover {
  background: #ddd;
  color: black;
}

and run npm run dev

but if you don't use

add to css

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial;
  font-size: 17px;
}

#myVideo {
  position: fixed;
  right: 0;
  bottom: 0;
  min-width: 100%; 
  min-height: 100%;
}

.content {
  position: fixed;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  color: #f1f1f1;
  width: 100%;
  padding: 20px;
}

#myBtn {
  width: 200px;
  font-size: 18px;
  padding: 10px;
  border: none;
  background: #000;
  color: #fff;
  cursor: pointer;
}

#myBtn:hover {
  background: #ddd;
  color: black;
}

html

<video autoplay muted loop id="myVideo">
  <source src="xample.mp4" type="video/mp4">
</video>

<div class="content">
  <h1>Heading</h1>
  <p>Lorem ipsum dolor sit amet, an his etiam torquatos. Tollit soleat phaedrum te duo, eum cu recteque expetendis neglegentur. Cu mentitum maiestatis persequeris pro, pri ponderum tractatos ei. Id qui nemore latine molestiae, ad mutat oblique delicatissimi pro.</p>
  <button id="myBtn" onclick="myFunction()">Pause</button>
</div>
Activity icon

Replied to Update Multiple Record

@mvd thx work

but I have to fix it a little

$product = Product::find($row['product_id'])->decrement('quantity', $row['qty']);
May
17
1 week ago
Activity icon

Replied to Update Multiple Record

@mvd , @tray2 hi maybe I misplaced it ... if it's like this where should I write it

foreach ($carts as $row) {
           $product = Product::find($row['product_id']);

           OrderDetail::create([
                    'penjualan_id' => $order->id,
                    'product_id' => $row['product_id'],
                    'price' => $row['price'],
                    'qty' => $row['qty'],
                ]);
}

if i try this

foreach ($carts as $row) {
           $product = Product::find($row['product_id'])->decrement('qty');

          $orders = OrderDetail::create([
                    'penjualan_id' => $order->id,
                    'product_id' => $row['product_id'],
                    'price' => $row['price'],
                    'qty' => $row['qty'],
                ]);

	dd($orders);
}

i get this

#attributes: array:7 [▼
    "penjualan_id" => 21
    "product_id" => 1
    "price" => "60000"
    "qty" => "1"
    "updated_at" => "2020-05-17 18:02:42"
    "created_at" => "2020-05-17 18:02:42"
    "id" => 18
  ]
  #original: array:7 [▼
    "penjualan_id" => 21
    "product_id" => 1
    "price" => "60000"
    "qty" => "1"
    "updated_at" => "2020-05-17 18:02:42"
    "created_at" => "2020-05-17 18:02:42"
    "id" => 18
  ]

note my 'qty' only gets the number 'qty' = 1 but I write for two items with different numbers and it's not one

May
16
1 week ago
Activity icon

Replied to Error Explode() Expects Parameter 2 To Be String, Array Given

@nakov what if I want to save both data using json_decode?

Activity icon

Replied to Error Explode() Expects Parameter 2 To Be String, Array Given

@nakov if i try json_encode()

i get this

""{\"1\":{\"qty\":\"2\",\"product_id\":1,\"nama_barang\":\"Deaved Covid-19\",\"price\":\"60000\"},\"2\":{\"qty\":\"2\",\"product_id\":2,\"nama_barang\":\"Bedak Baby\",\"price\":\"25000\"}}" ◀"

and this array will be stored in 2 columns

Activity icon

Replied to Error Explode() Expects Parameter 2 To Be String, Array Given

@nakov then what if I want to save both data

Activity icon

Started a new Conversation Error Explode() Expects Parameter 2 To Be String, Array Given

hey what's up with my code ..

controller

$affiliate = json_decode(request()->cookie('babybekasi'), true);

$explodeAffiliate = explode('-', $affiliate);

i get this message

error explode() expects parameter 2 to be string, array given

the reuslt from $affiliate = json_decode(request()->cookie('babybekasi'), true);

array:2 [▼
  1 => array:4 [▼
    "qty" => "2"
    "product_id" => 1
    "nama_barang" => "Deaved Covid-19"
    "price" => "60000"
  ]
  2 => array:4 [▼
    "qty" => "2"
    "product_id" => 2
    "nama_barang" => "Bedak Baby"
    "price" => "25000"
  ]
]

but i try

$affiliate = json_encode(request()->cookie('babybekasi'), true);

$explodeAffiliate = explode('-', $affiliate);

the data is stored in the table but becomes 2 columns not become an array

thx for your answer

Activity icon

Replied to Store Array

@prasadchinwal5 youre welcome

May
15
1 week ago
Activity icon

Replied to Store Array

@prasadchinwal5 I chose to change the data type in schema to json

thx for youre answer

May
14
1 week ago
Activity icon

Started a new Conversation Store Array

hello how to store array data like this blade

<label for="nama_barang">Nama Barang</label>
                                    <select name="product_id[]" id="" class="form-control" multiple="multiple">
                                        <option value="">Pilih Nama Barang</option>
                                        @forelse($products as $product)
                                            <option value="{{$product->id}}">{{$product->nama_barang}}</option>
                                        @empty
                                            <option value=""> tidak ada pilihan </option>
                                        @endforelse
                                    </select>

controller

$penjualan = Penjualan::create([
            'nama_customer' => $request->input('nama_customer'),
            'product_id'    => json_encode($request->product_id),
            'quantity'       => $request->input('quantity'),

        ]);

migration

$table->unsignedInteger('product_id');
SQLSTATE[HY000]: General error: 1366 
Incorrect integer value: '["1","2"]' 
for column 'product_id' at row 1 (SQL: insert into `penjualans` 
(`nama_customer`, `product_id`, `quantity`, `updated_at`, `created_at`) values (M.iqbal, ["1","2"], 3, 2020-05-14 20:56:05, 2020-05-14 20:56:05))

thx

Activity icon

Replied to Update Multiple Record

@tray2 , @mvd

I'll try your advice ... and I'll report back

Activity icon

Replied to An Email Has Not Sent

@batoolalsulh

.env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=email_registered_at_mailtrap
MAIL_PASSWORD=youre_pass
MAIL_ENCRYPTION=tls

for example here .env

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

maybe this can help you

Activity icon

Replied to Compile Sass To Packages

@jlrdw thank you the packages that I made are currently running and are still in the manufacturing stage

thank you for my solution is

  1. I have to get the sass file on the webpack
  2. when it has been uninstalled I have to add the command to copy files from resource / sass / file.sass and css to my packages automatically in the webpack
Activity icon

Started a new Conversation Update Multiple Record

598/5000 hello i want to ask? I have a case like this ... I want to update the data when I add new data to the sales table, the updated table is a product table with a stock field

the question is how if things happen like this when filling in the data to the sale I hold product_id [1,2,3] with stock_barang 3, stock_barang is divided for these 3 product_id example: product_id 1 => minus 1 product_id 2 => minus 1 product_id 3 => minus 1

I was confused about how to divide every item I entered into the sales table

Mar
04
2 months ago
Activity icon

Started a new Conversation Compile Sass To Packages

hello I'm trying to learn how to create a package for the admin template

here I want to ask how do I compile sass to packages

thank you

Jan
28
3 months ago
Activity icon

Awarded Best Reply on Something Wrong

solved done

i change keyup with

function calculate() {
        let nominal1 = document.getElementById('nominal1').value;
            let nominal2 = document.getElementById('nominal2').value;
            let result = document.getElementById('result');

            let total = nominal1 * nominal2;

        result.value = total;
        }
Activity icon

Replied to Something Wrong

solved done

i change keyup with

function calculate() {
        let nominal1 = document.getElementById('nominal1').value;
            let nominal2 = document.getElementById('nominal2').value;
            let result = document.getElementById('result');

            let total = nominal1 * nominal2;

        result.value = total;
        }
Activity icon

Started a new Conversation Something Wrong

hey all I'm confused with the code that I made why like this

I tried adding the tag to make a keyup

and I get the results that I want

but I realized that my web display became weird because the position of the nav under this happened because I forgot to close @section

but when I close @section ('content) @endsection The keyup doesn't work ... where is the error and why this can happen

here keyup working

app.blade.php

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>{{ config('app.name', 'Laravel') }}</title>
    <link rel="dns-prefetch" href="//fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css">

    <!-- Styles -->
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body>
    <div id="app">
        @include('layouts._nav')
        <main class="py-4">
            <div class="container">
                <div id="flash-msg">
                </div>
                @include('flash::message')
                @include('layouts._errors')
                @yield('content')
            </div>
        </main>
    </div>
    <script src="{{ asset('js/app.js') }}" defer></script>
    <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>

    <script>
        $("#nominal1 , #nominal2 ").keyup(function() {
            var val1 = $("#nominal1").val();
            var val2 = $("#nominal2").val();
            var kali = eval(val1) * eval(val2);

            if ( val1 != "" && val2 != "" ) {
                $('#total').val(kali);
            }

        });
    </script>
</body>
</html>

edit.blade.php

@extends('layouts.app')

@section('content')
<div class="justify-content-center">
    <div class="card border-0">
        <div class="card-body">
            <div class="mt-3 mb-3">
                <h5 class="text-muted">Saya memesan permintaan</h5>
                <h3 class="text-info font-weight-bold">
                    {{$categorie->name}}
                    <small>Rp. {{number_format($categorie->price,2)}}</small>
                </h3>
                <small>Silahkan isi formulir dibawah ini kak:</small>

                <div class="mt-2 mb-2">
                    <form action="{{route('pengajuan.store')}}" method="post">
                        @csrf
                        <div class="row">
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">Nama Lengkap :</label>
                                    <input type="text" name="name" class="form-control" placeholder="Nama Lengkap" value="{{old('name')}}" id="">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">Nomor Telp/Hp :</label>
                                    <input type="text" name="phone" class="form-control" placeholder="+62" value="{{old('phone')}}" id="">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">E-mail :</label>
                                    <input type="email" name="email" class="form-control" placeholder="[email protected]" value="{{old('email')}}" id="">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">Ceritakan Apa permasalahannya :</label>
                                    <input type="text" name="problem" class="form-control" placeholder="Ceritakan masalahnya apa" value="{{old('problem')}}" id="">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">Jumlah Unit:</label>
                                    <input type="number" name="unit" class="form-control" value="{{old('unit')}}" id="nominal1">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">Jenis merek ac:</label>
                                    <select name="type" class="form-control" id="">
                                        <option value=""> Pilih Jenis Ac Anda.</option>
                                        <option value="LG"> LG</option>
                                        <option value="Samsung"> Samsung</option>
                                        <option value="Politron"> Politron</option>
                                    </select>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">Tanggal permintaan :</label>
                                    <input type="date" name="request_date" class="form-control" value="{{old('request_date')}}" id="">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">Dijam berapa dibutuhkannya :</label>
                                    <input type="time" name="time" class="form-control" value="{{old('time')}}" id="">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    Rp.
                                    <input type="text" name="nominal" class="form-control" value="" id="total">
                                </div>
                            </div>

                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="name">Address :</label>
                                    <textarea name="address" class="form-control" id="" cols="30"></textarea>
                                </div>
                            </div>

                            <input type="hidden" name="status" value="waitting" id="">
                            <input type="hidden" name="nominal2" value="{{$categorie->price}}" id="nominal2">
                            <input type="hidden" name="categorie_id" value="{{$categorie->id}}" id="">
                        </div>

                        <div class="mt-3 mb-3">
                            <button type="submit" class="btn btn-outline-info">
                                Kirim Permintaan Saya
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

if i close @section not working

edit.blade.php

@extends('layouts.app')

@section('content')
<div class="justify-content-center">
    <div class="card border-0">
        <div class="card-body">
            <div class="mt-3 mb-3">
                <h5 class="text-muted">Saya memesan permintaan</h5>
                <h3 class="text-info font-weight-bold">
                    {{$categorie->name}}
                    <small>Rp. {{number_format($categorie->price,2)}}</small>
                </h3>
                <small>Silahkan isi formulir dibawah ini kak:</small>

                <div class="mt-2 mb-2">
                    <form action="{{route('pengajuan.store')}}" method="post">
                        @csrf
                        <div class="row">
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">Nama Lengkap :</label>
                                    <input type="text" name="name" class="form-control" placeholder="Nama Lengkap" value="{{old('name')}}" id="">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">Nomor Telp/Hp :</label>
                                    <input type="text" name="phone" class="form-control" placeholder="+62" value="{{old('phone')}}" id="">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">E-mail :</label>
                                    <input type="email" name="email" class="form-control" placeholder="[email protected]" value="{{old('email')}}" id="">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">Ceritakan Apa permasalahannya :</label>
                                    <input type="text" name="problem" class="form-control" placeholder="Ceritakan masalahnya apa" value="{{old('problem')}}" id="">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">Jumlah Unit:</label>
                                    <input type="number" name="unit" class="form-control" value="{{old('unit')}}" id="nominal1">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">Jenis merek ac:</label>
                                    <select name="type" class="form-control" id="">
                                        <option value=""> Pilih Jenis Ac Anda.</option>
                                        <option value="LG"> LG</option>
                                        <option value="Samsung"> Samsung</option>
                                        <option value="Politron"> Politron</option>
                                    </select>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">Tanggal permintaan :</label>
                                    <input type="date" name="request_date" class="form-control" value="{{old('request_date')}}" id="">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="name">Dijam berapa dibutuhkannya :</label>
                                    <input type="time" name="time" class="form-control" value="{{old('time')}}" id="">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    Rp.
                                    <input type="text" name="nominal" class="form-control" value="" id="total">
                                </div>
                            </div>

                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="name">Address :</label>
                                    <textarea name="address" class="form-control" id="" cols="30"></textarea>
                                </div>
                            </div>

                            <input type="hidden" name="status" value="waitting" id="">
                            <input type="hidden" name="nominal2" value="{{$categorie->price}}" id="nominal2">
                            <input type="hidden" name="categorie_id" value="{{$categorie->id}}" id="">
                        </div>

                        <div class="mt-3 mb-3">
                            <button type="submit" class="btn btn-outline-info">
                                Kirim Permintaan Saya
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

thx all

Jan
21
4 months ago
Activity icon

Replied to Keyup

@kbush thx buddy I misplaced

$ ("# nominal1", "# nominal2")

and I tried to change it to

$ ("# nominal1, # nominal2")
Activity icon

Replied to Keyup

@wraith is this what you mean

$("input[name='nominal1'],input[name='nominal2']").keyup(function() {
            var val1 = $("#nominal1").val();
            var val2 = $("#nominal2").val();
            var kali = eval(val1) * eval(val2);

            if ( val1 != "" && val2 != "" ) {
                $('#total').val(kali);
            }

        });
Activity icon

Started a new Conversation Keyup

hi what was missed or what was wrong from the code below I tried to calculate two data but the results did not appear

when I enter the first number and the second number I get the results automatically

<input type="number" name="unit" class="form-control" value="" id="nominal1">

<input type="text" name="nominal" class="form-control" value="" readonly id="nominal2">

<input type="text"  class="form-control" value="" readonly id="total">

$("input[name='nominal1'],input[name='nominal2']").keyup(function() {
            var val1 = $("input[name='nominal1']").val();
            var val2 = $("input[name='nominal2']").val();
            var kali = eval(val1) * eval(val2);

            if ( val1 != "" && val2 != "" ) {
                $('#total').val(kali);
            }

        });

thx guys

Dec
29
4 months ago
Activity icon

Replied to Count()

@snapey Of course but when I made the example above

$getData = [
    'users' = User::paginate(25),
    'employees' = Employee::paginate(25),
        'corporations' = Corporation::paginate(25),
        'banks' = Bank::paginate(25),
        'salary' = Salary::paginate(25,
    ];

    return view('admin.dashboard', $getData);

I hold all the data in getData, then in the view I call each individual data

here 
{{$users->total()}}

i call $users from $getData

I hope from this discussion I get new knowledge ... not to find who is the best ... and I hope you do not misunderstand my question thank you and once again I say sorry

Activity icon

Replied to Count()

@snapey Sorry then where is the difference? holds arrays in one getData parameter with compact.

Isn't the compact also an array?

Activity icon

Replied to Count()

@mehmetanbaki

maybe you can try this

public function index()
{

    $getData = [
    'users' = User::paginate(25),
    'employees' = Employee::paginate(25),
        'corporations' = Corporation::paginate(25),
        'banks' = Bank::paginate(25),
        'salary' = Salary::paginate(25,
    ];

    return view('admin.dashboard', $getData);
}

in blade

{{$users->total()}}

or 
({$users->getTotal()})

I hope this helps

Activity icon

Replied to Laravel Update Method Is Not Working

@brad_fresh99

example

1. 
<form action="{{route('categorie.change', $categorie->id)}}" method="POST">
@csrf
@method="PUT"
</form>

in route
route::put('categorie/change/{categorie}')->name('categorie.change');

2.
<form action="{{route('categorie.change', $categorie->id)}}" method="POST">
@csrf
@method="PATCH"
</form>

in route
route::patch('categorie/change/{categorie}')->name('categorie.change');

in controller

public function update(Request $request, $id){
youre code here

}
Activity icon

Replied to Settup Connection Mysql Larval Valet To Tableplus

@fylzero

not only that, I also forgot to install MySQL twice in a way

brew install mysql -> I get version 8
brew install mysql @ 57 -> I get version 5.7

mysql 8 version requires caching_sha2_password while the installation does not use a password

finally after I check again I do this

uninstall mysql brew
brew uninstall [email protected]

and uninstall it completely then reinstall 5.7

then install the password for the root user and work I can create a database on the console / terminal

Dec
28
4 months ago
Activity icon

Replied to Settup Connection Mysql Larval Valet To Tableplus

thx i close this thread

Activity icon

Replied to Settup Connection Mysql Larval Valet To Tableplus

@fylzero 8.0.18 Homebrew

and I try this

https://laracasts.com/discuss/channels/laravel/caching-sha2-password-error-when-running-php-artisan-migrate

SQLSTATE[HY000] [1049] Unknown database 'blog' (SQL: select * from information_schema.tables where table_schema = blog and table_name = migrations)

  at /Users/fajardev/Sites/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668| 

  Exception trace:

  1   PDOException::("SQLSTATE[HY000] [1049] Unknown database 'blog'")
      /Users/fajardev/Sites/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

  2   PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=blog", "root", "", [])
      /Users/fajardev/Sites/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
Dec
27
4 months ago
Activity icon

Started a new Conversation Settup Connection Mysql Larval Valet To Tableplus

hey, i want i try using laravel valet and homebrow and i have done it then i installed tabeplus to make konesi to mysql for new connection

but after when i configure it in laravel .env

for example connection

DB_CONNECTION = mysql
DB_HOST = 127.0.0.1
DB_PORT = 3306
DB_DATABASE = test
DB_USERNAME = root
DB_PASSWORD =

and I run the migrate command I can't connect

this error

Exception trace:

  1   PDOException::("PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]")
      /Users/fajardev/Sites/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

  2   PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=blog", "root", "", [])
      /Users/fajardev/Sites/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

Thank you for the help

Dec
25
4 months ago
Activity icon

Replied to Installation Fresh Laravel

@hadifox

go to youre project

for example project name WebApp

find folder vendor/symfony/translation-contracts/composer.json

and find line "symfony/translation-contracts":  change to "symfony/translation-contracts": "^1.1.6"

and now go to TranslatorInterface.php 
change to 
public function trans($id, array $parameters = [], $domain = null, $locale = null);

and go to  TranslatorTrait.php
change to
public function setLocale($locale);

and run composer update

thx

Activity icon

Replied to Upload Laravel Project To Github

@thedesignlog

  1. create account on github
  2. create new repositori
  3. access youre project example using linux "cd Code/Youre_Project_here" using window "cd c:\xampp\htdocs\Youre_project_here"
  4. type here git init
  5. git remote add origin https://github.com/username/coba.git
  6. git config --global user.name "username_on_github" 7.git config --global user.email "youre_email_on_github" 8.git add .
  7. git commit -m "first commit"
  8. git push -u origin master
note :
for run commang git 
using bing run aplikasi git bash

hope this helps you

Dec
16
5 months ago
Activity icon

Started a new Conversation Notifications Build Success

hey..

I want to ask how to enable the Buill Success notification if we run the npm run dev command

I use ubuntu homestead and ohmyzsh

because when i run npm run dev doesn't exist...

Dec
07
5 months ago
Activity icon

Awarded Best Reply on Mb_strpos() Expects Parameter 1 To Be String, Object Given

all

i fixed with

first i change my controller

from
$types = Type::with(['premis', function($premis){
                $premis->where('name', 'Motor KOE');
        }])->get();

return Datatables($types)->toJson();

to

public function json(){
        $table = DB::table('types')
        ->join('premis', function ($join) {
            $join->on('types.id', '=', 'premis.type_id')
                 ->where('types.name', 'Motor KOE');
        })
        ->get();

        return Datatables::of($table)->make(true);

    }

and this my blade

@push('scripts')
<script>
    $(function(){
        $('#premi-table').DataTable({
            processing: true,
            serverSide: true,
            ajax: '{!! route('types.json') !!}',
            aoColumns: [
                {mData : 'price', name: 'price'},
                {mData : 'premi_1', name:'premi_1'},
                {mData : 'premi_2', name:'premi_2'},
                {mData : 'premi_3', name:'premi_3'},
            ]
        });
    });
</script>
@endpush

thx all for youre attention

Activity icon

Replied to Mb_strpos() Expects Parameter 1 To Be String, Object Given

@nakov

your first reply

$types = Type::with(['premis' => function($premis){
                $premis->where('name', 'Motor KOE');
        }])->get();

i get an error

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name' in 'where clause' (SQL: select * from `premis` where `premis`.`type_id` in (2, 3, 4) and `name` = Motor KOE)

why because in the premise table there is no field name while the name field is in the types table

for second your reply

$premises = App\Type::where('name','Motor KOE')->premis;

i get an error again

Property [premis] does not exist on the Eloquent builder instance.

after I tried again I found a solution to my problem

i change my controller

from

$types = Type::with(['premis', function($premis){
                $premis->where('name', 'Motor KOE');
        }])->get();

return Datatables($types)->toJson();

to

public function json(){
        $table = DB::table('types')
        ->join('premis', function ($join) {
            $join->on('types.id', '=', 'premis.type_id')
                 ->where('types.name', 'Motor KOE');
        })
        ->get();

        return Datatables::of($table)->make(true);

    }

and if i run i get this

{"draw":0,"recordsTotal":1,"recordsFiltered":1,"data":[{"id":"2","code_premi":"0210","name":"Motor KOE","manfaat":null,"description":"Motor Koe hanya untuk motor","created_at":"2019-12-06 09:44:14","updated_at":"2019-12-06 09:44:14","type_id":"2","price":"70000000","premi_1":"5000000","premi_2":"6000000","premi_3":"7000000","premi_4":null,"premi_5":null,"premi_6":null,"premi_7":null,"premi_8":null,"cost_premi":0}],"input":[]}

and then in my blade

@push('scripts')
<script>
    $(function(){
        $('#premi-table').DataTable({
            processing: true,
            serverSide: true,
            ajax: '{!! route('types.json') !!}',
            aoColumns: [
                {mData : 'price', name: 'price'},
                {mData : 'premi_1', name:'premi_1'},
                {mData : 'premi_2', name:'premi_2'},
                {mData : 'premi_3', name:'premi_3'},
            ]
        });
    });
</script>
@endpush

thx all

Activity icon

Replied to Mb_strpos() Expects Parameter 1 To Be String, Object Given

all

i fixed with

first i change my controller

from
$types = Type::with(['premis', function($premis){
                $premis->where('name', 'Motor KOE');
        }])->get();

return Datatables($types)->toJson();

to

public function json(){
        $table = DB::table('types')
        ->join('premis', function ($join) {
            $join->on('types.id', '=', 'premis.type_id')
                 ->where('types.name', 'Motor KOE');
        })
        ->get();

        return Datatables::of($table)->make(true);

    }

and this my blade

@push('scripts')
<script>
    $(function(){
        $('#premi-table').DataTable({
            processing: true,
            serverSide: true,
            ajax: '{!! route('types.json') !!}',
            aoColumns: [
                {mData : 'price', name: 'price'},
                {mData : 'premi_1', name:'premi_1'},
                {mData : 'premi_2', name:'premi_2'},
                {mData : 'premi_3', name:'premi_3'},
            ]
        });
    });
</script>
@endpush

thx all for youre attention

Activity icon

Replied to Mb_strpos() Expects Parameter 1 To Be String, Object Given

@snapey I just want to display data like this

i got this data from php artisan tinker

App\Type::with('premis')->where('name','Motor KOE')->get();
=> Illuminate\Database\Eloquent\Collection {#3097
     all: [
       App\Type {#3082
         id: 2,
         code_premi: "0210",
         name: "Motor KOE",
         manfaat: null,
         description: "Motor Koe hanya untuk motor",
         created_at: "2019-12-06 09:44:14",
         updated_at: "2019-12-06 09:44:14",
         premis: Illuminate\Database\Eloquent\Collection {#3105
           all: [
             App\Premi {#3102
               id: 2,
               type_id: 2,
               price: 70000000,
               premi_1: 5000000,
               premi_2: 6000000,
               premi_3: 7000000,
               premi_4: null,
               premi_5: null,
               premi_6: null,
               premi_7: null,
               premi_8: null,
               cost_premi: 0,
               created_at: "2019-12-06 09:44:14",
               updated_at: "2019-12-06 09:44:14",
             },
           ],
         },
       },
     ],
   }
>>> 

my question is how to display data in the premise table with the parameter name in the types table

Activity icon

Replied to Mb_strpos() Expects Parameter 1 To Be String, Object Given

@snapey

types table



id
code_premi
name
manfaat
description

and premis table

id
type_id
price
premi_1
premi_2
premi_3

I want to bring up

premise with the type name Motor KOE

Activity icon

Replied to Mb_strpos() Expects Parameter 1 To Be String, Object Given

@nakov if i use this

$types = Type::with(['premis' => function($premis){
                $premis->where('name', 'Motor KOE');
        }])->get();

I got this message

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name' in 'where clause' (SQL: select * from `premis` where `premis`.`type_id` in (2, 3, 4) and `name` = Motor KOE)
Activity icon

Started a new Conversation Mb_strpos() Expects Parameter 1 To Be String, Object Given

hey buddy's I get an error message when trying to display data with datatables

mb_strpos() expects parameter 1 to be string, object given

this my code

 $types = Type::with(['premis', function($premis){
                $premis->where('name', 'Motor KOE');
        }])->get();

return Datatables($types)->toJson();

Thank you for the help

Activity icon

Replied to How TO Fix Allowed Memory Size Of 2097152 Bytes Exhausted (tried To Allocate 4096 Bytes) In /opt/lampp/htdocs/blog/vendor/composer/autoload_static.php On Line 133

@herry88 find php.ini ini ubuntu 16.04:/etc/php/7.0/apache2

and find this line

memory_limit = 256M to memory_limit = 2GB

maybe this can help you

Activity icon

Replied to SQLSTATE[HY000]: General Error: 1364 Field 'username' Doesn't Have A Default Value (SQL: Insert Into `users` (`name`, `email`, `password`, `admin`, `active`, `membership_id`, `membership_started`, `membership_expired`, `token`, `updated_at`, `created_at`)

@roywealth did you change the name to username in the users table ... maybe this can help

  1. User.php
protected $fillable = [
    'name', 'email', 'password','admin','active','membership_id','membership_started','membership_expired','token','d_code'
];

to

protected $fillable = [
    'username', 'email', 'password','admin','active','membership_id','membership_started','membership_expired','token','d_code'
];

blade


from
<div class="input-group {{ $errors->has('name') ? ' has-error' : '' }}">
<span class="input-group-addon">
        <i class="material-icons">face</i>
</span>
     <div class="form-group label-floating">
            <label class="control-label" for="name">Full Name</label>
        <input id="name" 
                 type="text" 
                             class="form-control" name="name" value="{{ old('name') }}" required autofocus>

                                @if ($errors->has('name'))
                                    <span class="help-block">
                                    <strong>{{ $errors->first('name') }}</strong>
                                </span>
                                @endif
  </div>
</div>

to

<div class="input-group {{ $errors->has('username') ? ' has-error' : '' }}">
<span class="input-group-addon">
        <i class="material-icons">face</i>
</span>
     <div class="form-group label-floating">
            <label class="control-label" for="name">Full Name</label>
        <input id="username" 
                 type="text" 
                             class="form-control" name="username" value="{{ old('username') }}" required autofocus>

                                @if ($errors->has('username'))
                                    <span class="help-block">
                                    <strong>{{ $errors->first('username') }}</strong>
                                </span>
                                @endif
  </div>
</div>

thx

Activity icon

Replied to Installation Fresh Laravel

@hadifox i add in.

for example my project is blog

and i add 
"symfony/translation-contracts": "^1.1.6"
in 
blog
    -composer.json

here

"license": "MIT",
    "require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "laracasts/flash": "^3.0",
        "laravel/framework": "5.7.*",
        "laravel/tinker": "^1.0",
        "symfony/translation-contracts": "^1.1.6"
    },

full composer.json

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "laracasts/flash": "^3.0",
        "laravel/framework": "5.7.*",
        "laravel/tinker": "^1.0",
        "symfony/translation-contracts": "^1.1.6"
    },
    "require-dev": {
        "beyondcode/laravel-dump-server": "^1.0",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.0"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}

thx

Dec
06
5 months ago
Activity icon

Replied to Where Are You All From?

Jakarta, Indonesia