kankai

kankai

Member Since 1 Year Ago

Experience Points
7,360
Total
Experience

2,640 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
48
Lessons
Completed
Best Reply Awards
0
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 2
7,360 XP
Oct
05
2 weeks ago
Activity icon

Replied to Laravel Develop Idle Web Game

Oh i see, i'm not familiar with these. I thought it's relate to hardware and software of i put it on.

Oct
04
2 weeks ago
Activity icon

Replied to Laravel Develop Idle Web Game

Yup, will use laravel as backend. But it i just use laravel+apache+some javascript will it make server response slow to update/insert database?

Activity icon

Started a new conversation Laravel Develop Idle Web Game

Hi All,

I'm planning a project which is develop an idle html5 web game with simple chat system and player character can get exp in realtime. i need some advice what should i use to develop this project? I had some research in google some of people using node.js and vue. Any other suggestion? Thanks

Oct
02
2 weeks ago
Activity icon

Started a new conversation Database Multiple Table Insert/update Issue

Hi all,

I facing an issue that controller insert/update multiple tables failure sometimes.

tableA::insert([
    'name' => 'nameA',
    'status' => 0,
]);

tableB::insert([
    'name' => 'nameB',
    'status' => 0,
]);

Not sure is network problem or my application problem, it will miss out to insert data sometime. It's there anyway to avoid this happen? Thanks

Sep
23
3 weeks ago
Activity icon

Replied to Bootstrap Datepicker

Thank @alexdotdev , i solved this issue. It has issue in controller that makes laravel define it as wrong format date.

I change my view to your code as mention and controller to this

 // $dob = date("Y-m-d", strtotime($request->dob));
// $dob = $request->dob;
$dob = strtr($request->dob_editinput, '/', '-');
$dob = date("Y-m-d", strtotime($dob));
Sep
12
1 month ago
Activity icon

Started a new conversation Bootstrap Datepicker

Hi guys,

I have a issue when i use bootstrap datepicker change date format to 'dd/mm/yyyy'. It will return 1970-01-01, i guess it get wrong timestamp format so it return this result. Anyway to change this dateformat?

These is my code

<div class="input-group">
        <input autocomplete="off" name="dob" type="text" class="form-control mydatepicker" placeholder="Date of Birth" required="true">
          <div class="input-group-append">
                      <span class="input-group-text"><i class="fa fa-calendar"></i></span>
          </div>
 </div>
jQuery('.mydatepicker').datepicker({
         format: 'dd/mm/yyyy',
        autoclose: true,
        todayHighlight: true
    });
Sep
04
1 month ago
Activity icon

Started a new conversation Relation With Select

Hi Guys,

Is there anyway to filter my huge data by using relation and select certain column?

Controller

$reloadList = oldwork::where('done_time','<=', $dateFrom)->where('game_id','!=','')->where('status',0)->orWhere('done_time','>=', $dateTo)->where('game_id','!=','')->where('status', 0)->groupBy('game_id')->select('game_id')->get();

return $noreloadList->wallet;

oldwork Model

 public function wallet(){
        return $this->hasOne('App\wallet','wallet','wallet'); 
    }

I have around 4k non-repeat game_id in $reloadList, but after i try to use 'wallet' relation bind to these data, it come out i guess N+1 problem or data too huge.

Aug
29
1 month ago
Activity icon

Replied to Anyway To Pass Parameter Into Eloquent Function?

@tisuchi @martinbean I changed my code something like this, is it a correct way to solve this issue?

 $data = game_id::where('wallet', $inputValue)->get();
 $detail = $data[0]->game;
return $detail->where('done_time','>=', date('Y-m-d'));

Now i can get data but only single 'game_id' with '$data[0]' but i have 6 game_id. Is that need to push in array only i can get all game_id data?

Aug
27
1 month ago
Activity icon

Replied to Anyway To Pass Parameter Into Eloquent Function?

Thanks @tisuchi @siangboon , this is new thing to me. I think need some time to study it. =)

Aug
26
1 month ago
Activity icon

Started a new conversation Anyway To Pass Parameter Into Eloquent Function?

Hi guys,

I'm new to eloquent, is that anyway to pass parameter to eloquent function?

current game_id model

 public function detail(){
        return $this->hasMany('App\gamedata','game_id','game_id')->where('status',0);
 }

my controller

     $inputValue = $request->wallet;
        $data = game_id::with('detail')->where('wallet', $inputValue)->get();
    return view('playerfilter', compact('data'));

What i need is pass select date from controller to model there, something like this.

public function detail($date){
        return $this->hasMany('App\gamedata','game_id','game_id')->whereDate('created_at', $date)->where('status',0);
 }
Aug
07
2 months ago
Activity icon

Replied to Use Chunk To Get Query Still Slow

If use limit(400) only will get 400 rows? If i need to check all records in selected month it will be more than 5,000

Aug
06
2 months ago
Activity icon

Started a new conversation Use Chunk To Get Query Still Slow

Hi guys,

I building a system that need to check a records, it's output around 5,000 rows. When i use dd($data) it trace out very fast in 200ms, but when goes to view it took around 10seconds to finish loaded. I try to use chunk to get query, it had improve loaded out speed but still slow.

I try to load only {{ $row-id }} per row it become more fast, it there any problem with my code? Will it be frontend problem to cause it loading slow?

controller

$data = oldwork::where('category',$cat)->where('status',0)->where('done_time','>=', $dateFrom)->where('done_time','<=', $dateTo)->get();

$data = $data->chunk(400);

views

@foreach($data as $chunk)
                                                @foreach($chunk as $row)
                                                    <tr>
                                                        <td scope="col">
                                                            <!-- {{ $row->id }} -->
                                                        </td>
                                                        <td scope="col">
                                                            {{ $row->game_id }}
                                                        </td>
                                                        <td scope="col">
                                                            {{ $row->reference }}
                                                        </td>
                                                        <td scope="col">
                                                            {{ $row->bank }}
                                                        </td>
                                                        <td scope="col">
                                                            {{ $row->capital }}
                                                        </td>
                                                        <td scope="col">
                                                            {{ $row->done_time }}
                                                        </td>
                                                    </tr>
                                                @endforeach
                                            @endforeach
                                                
Jul
31
2 months ago
Activity icon

Replied to New Database Get Data Very Slow

If i need to handle more than 50 items, beside adding indexes what else can i do with my code or database?

Activity icon

Started a new conversation New Database Get Data Very Slow

Hi guys,

I'm bad with database manage, before that i create a management system to record sales data. It's run quite smoothly with normal php and html codes. Then now i upgraded myself and created a new one included javascript and try model to get database data.

But i found out it loaded very slow and took 10800ms to finish it (the old one took 420ms), not sure what's wrong with it.

the old one

$data = DB::table('oldworks')->where('category',$cat)->where('status',0)->where('created_at','>=', $getdateValuefrom)->where('created_at','<=', $getdateValueto)->get();

new

use Illuminate\Database\Eloquent\Model;
class oldwork extends Model
{
    //
    protected $table = 'oldworks';
}

 $data = oldwork::where('category', $cat)->where('status', 0)->where('created_at','>=',$getdateValuefrom)->where('created_at','<',$getdateValueto)->get();

Both of the database are same

Jun
27
3 months ago
Activity icon

Replied to Unicode Problem, Output Strange Words When In Chinese

Hi Guys,

I found solution from google, it change the words unicode when i "loadHTML" , "saveHTML". I added in these code and solved it.

$doc->loadHTML('<?xml encoding="UTF-8">'. $detail);
 $detail = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
        $detail .= $doc->saveHTML( $doc->documentElement ); // important!
Jun
26
3 months ago
Activity icon

Replied to Unicode Problem, Output Strange Words When In Chinese

@BOBBYBOUWMANN - yaya, i just type chinese text and images into it and db there come out these strange words

Jun
23
3 months ago
Activity icon

Started a new conversation Unicode Problem, Output Strange Words When In Chinese

Hi guys,

I'm using summernote editor post content and upload image to my website. But i found out unicode problem and save strange words to my db.

常勇和舒森不仅是男神女神,也是超有才华的YouTuber哦!从高中毕业到大学毕业,两人都在彼此的身边!【高中到大å­

i suspect these code will affect to output but i'm not good with these

$detail=$request->input('detail');

$dom = new \DomDocument();

$dom->loadHtml($detail, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); 
        
$images = $dom->getElementsByTagName('img');

foreach($images as $k => $img){

            $data = $img->getAttribute('src');

            list($type, $data) = explode(';', $data);

            list(, $data)      = explode(',', $data);

            $data = base64_decode($data);

            $image_name= "/upload/" .time().$k.'.jpg';


            $path = public_path() . $image_name;

            file_put_contents($path, $data);

            $img->removeAttribute('src');

            $img->setAttribute('src', $image_name);

        }

        $detail = $dom->saveHTML();
Jun
20
3 months ago
Activity icon

Replied to Return Html Code To View With Javascript Have Repeat Issue

Hi guys, i solved the problem. It's because view structure cause post form POST it several times. I restructure the view and problem solved, thanks.

Activity icon

Replied to Return Html Code To View With Javascript Have Repeat Issue

@CRONIX - It still will repeat view, i think my view structure have problem.

Jun
19
4 months ago
Activity icon

Started a new conversation Return Html Code To View With Javascript Have Repeat Issue

Hi guys,

I have use ajax post and get return data to views, but i notice that it have repeat my html code issue.

Controller

$view = view ('content', compact('todayDate'));
return $view;

Ajax

success: function(response){
    console.log('test')
    data(response);
 },


function data(data){
    $('#content').empty().html(data);
}   

View

<form id="selectDate" action="" method="">
                                            <li>
                                                <div class="input-group">
                                                    <input autocomplete="off" id="date_from" name="date_from" type="text" class="form-control mydatepicker" placeholder="From current date">
                                                    <div class="input-group-append">
                                                        <span class="input-group-text"><i class="fa fa-calendar"></i></span>
                                                    </div>
                                                </div>
                                            </li>
                                            <li>
                                                <div class="input-group">
                                                    <input autocomplete="off" id="date_to" name="date_to" type="text" class="form-control mydatepicker" placeholder="To current date">
                                                    <div class="input-group-append">
                                                        <span class="input-group-text"><i class="fa fa-calendar"></i></span>
                                                    </div>
                                                </div>
                                            </li>
                                            <li>
                                                <button type="submit" class="btn btn-info">Check</button>
                                            </li>
                                        </form>

I try to use console 'test' at the first time, it come out once 'test'. The second time it will come out twice 'test', and the third time it will come out 3 times.

Jun
17
4 months ago
Activity icon

Replied to How To Get New Data With Ajax Post?

@REACHED - It show fully of updated html code

Activity icon

Started a new conversation How To Get New Data With Ajax Post?

Hi guys,

I'm new with ajax. I try to make an query about searching data from date to date, i can create post datepicker input to controller but don't know how to get updated data return back to views.

Here are my code, thank you.

Views:

<input autocomplete="off" id="date_from" name="date_from" type="text" class="form-control mydatepicker" placeholder="From current date">
<input autocomplete="off" id="date_to" name="date_to" type="text" class="form-control mydatepicker" placeholder="To current date">

<script type="text/javascript">
        submitForm('#selectDate','{{ url("analysis/data") }}')

    function init(){
            $.get('/analysis/datainfo', function(data){
                $('#datainfo').empty().html(data)
            })
        }
    
        init()
</script>

Javascript:

function submitForm(){
  var parameterLength = arguments.length;
  var formID = arguments[0];
  var postUrl = arguments[1];
  
  $(document).ready(function() {
    $(formID).submit(function (ev) {
         $.ajaxSetup({
             headers: {
                 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
             }
        });
        $.ajax({
            method: 'POST', // Type of response and matches what we said in the route
            url: postUrl, // This is the url we gave in the route
            data:$(formID).serialize(), // a JSON object to send back
            success: function(response){ // What to do if we succeed
              console.log(response);
              result(response);
            },
            error: function(jqXHR, textStatus, errorThrown) { // What to do if we fail

              console.log(JSON.stringify(jqXHR));
              console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
            },
        });
        ev.preventDefault();
    });
  });
}

controller:

public function show(Request $request)
    {
        //
        $start = $request->date_from;
        $end = $request->date_to;

        if ($start > $end) {
            $msg = 'Invalid Start/End date setting';
            $status = 'error';
            $timer = 2000;
        }else{
            $todayDate = $start;
            // $todayDate = date('Y-m-d');
            $categoryList = category::where('status', 0)->get();
            $dailyReport = report::where('type', 0)->whereDate('created_at', $todayDate)->get();
          

            $msg = 'Operation successful';
            $status = 'success';
            $timer = 1500;

            return response()->json([
                // 'effect' => 'updated',
                'msg' => $msg,
                'status' => $status,
                'timer' => $timer,
                'showConfirm' => false,
                // 'btnTxt' => 'Continue?',
                // 'confirmBtn' => '#ffcc00',
                'position' => 'bottom-end',
                // 'showCancel' => true,
                // 'cancelBtn' => '#ff0000',
                'mini' => true,
                // 'debug' => $dateFrom,
            ]);  


            return view ('data', compact('todayDate','categoryList','dailyReport'));
           
        }     
Jun
09
4 months ago
Activity icon

Replied to Get Element ID Value Under Element ID

@JOHNBRAUN - Thanks @johnbraun , solved the problem =)

Jun
07
4 months ago
Activity icon

Replied to Get Element ID Value Under Element ID

@JOHNBRAUN - i try to use option 1 it come out an error.

ajax.js:99 Uncaught TypeError: Cannot read property 'id' of null at HTMLFormElement. (ajax.js:99) at HTMLFormElement.dispatch (jquery.min.js:2) at HTMLFormElement.y.handle (jquery.min.js:2)

Activity icon

Started a new conversation Get Element ID Value Under Element ID

Hi Guys,

I'm facing problem which need to get element id value under a element id.

<form id="form0" action="">
<input id="gameID" type="text" class="form-control" placeholder="Game ID">
</form>

anyway to get gameID value with javascript?

May
06
5 months ago
Activity icon

Replied to Can I Flexible Change Function Name In Javascript?

@FTIERSCH - Is this correct?

function submitForm(){
  var parameterLength = arguments.length;
  var formID = arguments[0];
  var postUrl = arguments[1];
  var _func = arguments[2];
  
  //
  $(document).ready(function() {
    $(formID).submit(function (ev) {
        //
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        $.ajax({
            method: 'POST', // Type of response and matches what we said in the route
            url: postUrl, // This is the url we gave in the route
            data:$(formID).serialize(), // a JSON object to send back
          success: function(response){ // What to do if we succeed
              var _func = result(_data) {

}

          },
          error: function(jqXHR, textStatus, errorThrown) { // What to do if we fail
            console.log(JSON.stringify(jqXHR));
            console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
          }
        });
        ev.preventDefault();
    });
  });
}


function result(_data){
  console.log(_data);
}

submitForm('#requestForm','home', resFunc)
Activity icon

Started a new conversation Can I Flexible Change Function Name In Javascript?

Hi guys,

I'm currently creating my own javascript library, so i started with ajax submit form and i need to make it have flexible result effect. Is there anyway to make function name replace with parameter?

function submitForm(){
  var parameterLength = arguments.length;
  var formID = arguments[0];
  var postUrl = arguments[1];
  var _func = arguments[2];
  
  //
  $(document).ready(function() {
    $(formID).submit(function (ev) {
        //
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        $.ajax({
            method: 'POST', // Type of response and matches what we said in the route
            url: postUrl, // This is the url we gave in the route
            data:$(formID).serialize(), // a JSON object to send back
          success: function(response){ // What to do if we succeed
              _func(response);
          },
          error: function(jqXHR, textStatus, errorThrown) { // What to do if we fail
            console.log(JSON.stringify(jqXHR));
            console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
          }
        });
        ev.preventDefault();
    });
  });
}


function result(_data){
  console.log(_data);
}

submitForm('#requestForm','home','result')

Something like this but i got an error said that _func is not a function. Anyway to make this works?

May
02
5 months ago
Activity icon

Replied to Add Column With Javascript But Cant Add Another One

@PHPHUPPTECHNOLOGIES - oh god, just a little changes. Thanks!

Activity icon

Started a new conversation Add Column With Javascript But Cant Add Another One

Hi all, i'm not good in javascript and i try to create a button that can add more row on my table. But it only can add once and can't continue add another one when i click button again.

<script type="text/javascript">
        var count=0;
        var tr = document.createElement("TR");
        var td0 = document.createElement("TD");
        var td1 = document.createElement("TD");
        var input0 = document.createElement("INPUT");
        var input1 = document.createElement("INPUT");
        input0.setAttribute('type', 'text');
        input0.setAttribute('class', 'form-control');
        input1.setAttribute('type', 'text');
        input1.setAttribute('class', 'form-control');

        document.getElementById("medicine_btn").addEventListener("click", function(event){
            event.preventDefault()
            //
            count++
            form = document.getElementById('medicine_form');
            input0.setAttribute('name', 'no'+count);
            input1.setAttribute('name', 'medicine'+count);
            //
            td0.appendChild(input0);
            td1.appendChild(input1);
            //
            tr.append(td0,td1);
            form.append(tr);
            console.log(count);
        });

         
           
         
    </script>
May
01
5 months ago
Apr
30
5 months ago
Activity icon

Started a new conversation Save Array Type To Database And Read It With Separate Format

Hi all,

I have a project that need to save medicine data to database which is need to use array. But i have no idea how to save it in array format or json format.

The flow should be like this

medicineA  x3
medicineB x4
medicineC x2

save to database column should show this

"medicineA" : {
    "quantity" : 3
},
"medicineB" : {
    "quantity" : 4
},
"medicineC" : {
    "quantity" : 2
},

I imagine will be like this, hope this figure you can understand and thanks for your help

Feb
19
8 months ago
Activity icon

Started a new conversation How To Create Multiple Ip Addresses On Single Server

Hi guys,

I'm new to server and server network, i have few project that need to host few website on single centos server and also with different ip addresses.

I have google on it and get some solution that server need IIS but i'm have no idea how to setup IIS to server.

Is there any requirement for server to setup this multiple ip addresses on single server?

Jan
09
9 months ago
Activity icon

Replied to Get Looping Data Failed Sometimes

Sorry about bad english, what i need to get is something like this.

I have a wallet UID called '91211', and under this UID have 3 IDs which is IDA,IDB, IDC.
in 'game_id' db table, i have IDA, IDB, IDC, each IDs have their own data like
[id => IDA , reload => 9 ] 
[id => IDA , reload => 10]
[id => IDB , reload => 9 ] 
[id => IDB , reload => 10]
[id => IDB , reload => 9 ] 
[id => IDC , reload => 10]
[id => IDC , reload => 9 ] 

So when i search UID '91211', i can get all data about this UID.

Jan
07
9 months ago
Activity icon

Started a new conversation Get Looping Data Failed Sometimes

Hi All,

I have facing this problem when i use query parameter grouping, in my form i have search an UID : 12345 which is contain IDA, IDB, IDC. So i need to get both of this three ID data, at the end i found out some UID can get all IDs data but some only get first ID data.

$UID = $request->player_id;
$tags = DB::table('game_id')->where('status',0)->where('wallet',$UID)->pluck('game_id');

 $gameData = id_data::where(function($query) use($tags)
                    {
                        foreach($tags as $tags)
                        {
                            $query->where('game_id',$tags)->orWhere('game_id', $tags);
                        }
                    })->orderBy('created_at','dsc')->get();

Is there something wrong with my code? Please help me, thank you very much.

Jan
02
9 months ago
Activity icon

Started a new conversation Permission Denied For Laravel Storage Logs

Hi All,

I have installed laravel in centos7 with apache, after intalled laravel i found out this error message

The stream or file "/var/www/html/storage/logs/laravel-2019-01-03.log" could not be opened: failed to open stream: Permission denied

And then i had tried to change storage folder to chmod -R 777 and even tried to change whole laravel application folder to chmod -R 777. It's still came out same message.

Activity icon

Replied to Failed To Grab Laravel From Git

@TOKOIWESLEY - @tokoiwesley solved this problem, thank you very much.

Activity icon

Started a new conversation Failed To Grab Laravel From Git

Hi all,

I have setup a new centos server for my laravel project, but after i installed apache, mysql, php and composer i can't grab latest laravel git.

It came out a error message like this:

[RuntimeException]                                                                                              
  Failed to clone https://github.com/laravel/laravel.git, git was not found, check that it is installed and in y  
  our PATH env.            

First time saw this problem, anything goes wrong? Thank you

Nov
14
11 months ago
Activity icon

Replied to Cron Job For Godaddy Shared Hosting

@SKOOBI - Same, still not working :(

Activity icon

Started a new conversation Cron Job For Godaddy Shared Hosting

Hi All,

I'm doing a web and would like to insert data by using laravel cron job, but godaddy is different from my valet localhost. I can't use

 * * * * * /usr/local/bin/php /usr/local/var/www/projectName/artisan schedule:run >> /dev/null 2>&1

I also did some research and found out need to do a setting in cpanel but it not successful also. https://my.godaddy.com/help/create-cron-jobs-3548

Anyone have idea? thank you

Nov
13
11 months ago
Activity icon

Replied to Show Select Array Value In View

@ANDREICH1980 - The error message is 'Undefined index', but now i tried your code and problem has been solved. Thank you very much!

Activity icon

Started a new conversation Show Select Array Value In View

Hi all,

I'm new with eloquent realationship, what i'm doing is having 3 database tables and i success get all data. I'm joining database table 'work' with 'wallet' and 'appsData', but i'm facing problem that how to show these data in view.

[{"game_id":"1001","check_wallet":[{"id":355,"wallet":"20314","game_id":"1001","status":0,"warning":0,"create_user":"WENDY","edit_user":null,"delete_user":null,"created_at":"2018-06-01 08:53:07","edited_at":"2018-06-01 08:53:07","check_detail":[{"id":1228,"wallet_id":"20314","apps_type":"whatsapp","prev_apps_id":null,"apps_id":"abc","type":null,"remarks":null,"status":0,"created_at":"2018-06-01 08:53:07","created_user":"WENDY"}]}]}

I need to show "apps_type", i have try echo it with {{ $data->check_detail->apps_type }} But it comes out error, what is the correct syntax to select this value in array? Thanks

Oct
13
1 year ago
Activity icon

Started a new conversation Give Database A Variable And Get Data

Hi all,

i have a database with table name 'sku_code', and then i need to get database data with variable.

$productData = DB::table('ecommerce_products')->where('slug', $value)->get();
dd($productData['sku_code'] );

It come out an error, is there any way to get a value like this?

Sep
04
1 year ago
Activity icon

Started a new conversation Query Multiple Data

Hi all,

I need to return a result with multiple query, here is my code and it only return with '[ ]' symbol.

$tags = DB::table('game_id')->where('status',0)->where('wallet',$player_id)->pluck('game_id');
        
            $data = oldwork::where(function($query) use($tags)
            {
                foreach($tags as $tags)
                {
                    $query->where('game_id', $tags);
                }
            })->get();

            return $data;   

It's there any problem with my code?

Aug
16
1 year ago
Activity icon

Replied to Custom Make Language File And Keywords

@Yamen Thank you, solve my problem :)

Aug
13
1 year ago
Activity icon

Started a new conversation Custom Make Language File And Keywords

Hi Guys,

I have use laravel create a page that use js localstorage to set website language but i wish to key in my keyword in array form instead of using laravel set locale function. But i have no idea how to make a language file and get the keyword direct from language file to view blade.

Aug
09
1 year ago
Activity icon

Replied to Enter To Submit Form And Load Certain Part

It's work very nicely, thank you very much! :)

Activity icon

Replied to Enter To Submit Form And Load Certain Part

I never use preventDefault() before, for my understanding is this will stop browser reload page after form has submitted?

Activity icon

Replied to Enter To Submit Form And Load Certain Part

Is there any way that can make the page not refresh after submit form? If scroll to middle part of page, after submit form it will refresh and go back to top of the page.