kankai

kankai

Member Since 1 Year Ago

Experience Points 5,530
Experience Level 2

4,470 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 39
Lessons
Completed
Best Reply Awards 0
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.

19 Feb
2 months ago

kankai 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?

09 Jan
3 months ago

kankai left a reply on 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.

07 Jan
3 months ago

kankai 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.

02 Jan
3 months ago

kankai 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.

kankai left a reply on Failed To Grab Laravel From Git

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

kankai 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

14 Nov
5 months ago

kankai left a reply on Cron Job For Godaddy Shared Hosting

@SKOOBI - Same, still not working :(

kankai 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

13 Nov
5 months ago

kankai left a reply on 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!

kankai 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

13 Oct
6 months ago

kankai 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?

04 Sep
7 months ago

kankai 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?

16 Aug
8 months ago

kankai left a reply on Custom Make Language File And Keywords

@Yamen Thank you, solve my problem :)

13 Aug
8 months ago

kankai 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.

09 Aug
8 months ago

kankai left a reply on Enter To Submit Form And Load Certain Part

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

kankai left a reply on 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?

kankai left a reply on 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.

kankai left a reply on Enter To Submit Form And Load Certain Part

I tried to use ajax with tag, it will reload whole page when submit form. Do i need to remove and only use ajax?

   <form method="POST">
    <div>
        <input type="text" name="comment">
        <button type="submit" class="btn btn-info">Done</button>
    </div>
    </form> 

kankai started a new conversation Enter To Submit Form And Load Certain Part

I'm doing a comment form like Facebook comment which can post it with 'Return' key and reload comment part. Why i need to reload only comment part because this site have other huge information beside than comment part.

I have tried to use it will refresh whole page and take long time to finish loading a page. I believe this will need javascript to implement it, any reference or example that i can refer to?

Sorry about my broken english, hope your guys can understand my question.

07 Aug
8 months ago

kankai left a reply on Phpmyadmin 404 Not Found

Still not working, i had been change apache2.conf

<Directory /var/www/html/public>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

kankai started a new conversation Phpmyadmin 404 Not Found

Hi All,

I have installed laravel in aws ubuntu free tier server, for the first i have edit document root to www/html/public It has fixed all the route problem, but when i install phpmyadmin it come out phpmyadmin out 404 not found. Is it route conflict with laravel route?

Distributor ID: Ubuntu Description: Ubuntu 16.04.4 LTS Release: 16.04 Codename: xenial

i have try

sudo ln -s  /usr/share/phpmyadmin  /var/www/html/
Include /etc/phpmyadmin/apache.conf

created .  /etc/apache2/conf-enabled/phpmyadmin.conf

service apache2 restart

These will not work for me :(

23 Jul
8 months ago

kankai left a reply on Store Array Data Using Serialize

@m7vm7v Thanks for the advice and solution, issue solved and after reconsider illegal issue i change saving data to mobile no and telco. =)

20 Jul
9 months ago

kankai started a new conversation Store Array Data Using Serialize

Hi Guys,

I creating a page that can let user store in multiple bank name and bank account number. So what i'm thinking is store all bank details into database one column.

This is what i figure out, but i have no idea how to convert input to array type and serialize store into db and update array data.

View will be like this:

<table cellpadding="2" cellspacing="2" border="1" class="table table-striped table-bordered data-table">
                                <thead class="thead-default">
                                    <tr>
                                        <td>Bank</td>
                                        <td>Account Number</td>
                                        <td></td>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td> 
                                            <select name="bank" class="form-control">
                                                @foreach ($banklists as $list)
                                                 <option value="HSBC">HSBC</option>
                        <option value="OCBC">OCBC</option>
                                                @endforeach
                                            </select>
                                        </td>
                                        <td>{!! Form::text('full_name' ,null ,['class' => 'form-control', 'style' => 'max-width:300px;','required']) !!}</td>
                                        <td><button class="btn btn-danger">Add New Bank Account +</button></td>
                                    </tr>
                                </tbody>
                            </table>
 $bankDetails = array(
            'bank' => ['HSBC', OCBC],
            'account' => ['1829571929','12391023918'],
 );

serialize output should be like this, but how i'm going to select either one bank to update data?

"a:2:{s:4:"bank";a:2:{i:0;s:4:"HSBC";i:1;s:4:"OCBC";}s:7:"account";a:2:{i:0;s:10:"1829571929";i:1;s:11:"12391023918";}}"
24 Jun
9 months ago

kankai left a reply on Can't Connect To Mysql

I got the solution which is change user password format from caching_sha2_password to mysql_native_password :)

20 Jun
10 months ago

kankai started a new conversation Can't Connect To Mysql

Hi Guys,

I have using MacOS High Sierra, before reformat my mac i have used laravel valet, homebrew, mysql. But this morning i reformat my mac, and it cannot connect to mysql anymore.

when i use "php artisan migrate", it comes out this message

Illuminate\Database\QueryException  : SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrations)

  at /Users/limkankai/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| 

.env file

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:wnv3/dMuY9E6gd3wxPImqmBJ1/hFfIzsp7uHH8QrAW0=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

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

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

01 Jun
10 months ago

kankai started a new conversation Allow Facebook But Block Messenger

Hi all,

My office employee are using facebook when they are free, but i'm wish to not allow them to use fb messenger chat or voice call/video call. Is there anyway that can make router setting can block only messenger ip or port? Or make a setting in pc(window os)?

Thank you

30 May
10 months ago

kankai left a reply on Get Multiple Value From Views

Thank you very much :) @Cronix @Snapey

kankai started a new conversation Get Multiple Value From Views

Hi All,

I have use laravel do a search form with wallet id, from what wallet id get can make it add in game id or edit current id. But now i'm facing a problem is how to store a variable in views and pass it back to controller or send multiple value from button?

<table>
    <tr>
                <td>{{ $walletID }}</td>
                <td>{{ $gameName }}</td>
        <td>{{ $list->game_id }}</td>
                <td>
                      <form method="POST" action="">
                      {{ csrf_field() }}
                                    <input name="gameid_input" placeholder="{{ $game_id }} ID" class="form-control" required>
                 </td>
                 <td>
                       <button type="submit" class="btn btn-info" name="game_id" value1="{{ $walletID }}" value="{{ $gameName }}">Add +</button>
                    </form>
        </td>
         </tr>
</table>

What i want is pass wallet ID and gameName to controller, thank you.

19 May
11 months ago

kankai left a reply on Get Multiple Condition Into Array

@biishmar I just watch that tutorial video from laracast, will try out will the solution. Thank you

18 May
11 months ago

kankai started a new conversation Get Multiple Condition Into Array

Hi guys,

I have a question it's about to get 'not fix amount' condition from query. This is my code and i try to get it push into array but it's not working, any other way to make this happen?

$totalgameIdcount = DB::table('wallet_id')->where('status',0)->where('wallet',$player_id)->where('game_id', '<>', '', 'and')->count();

$totalgameId = DB::table('wallet_id')->where('status',0)->where('wallet',$player_id)->where('game_id', '<>', '', 'and')->pluck('game_id');

$playeridArray=array();

 for($i = 0; $i = $totalgameIdcount-1; $i++)
{
    
    $playeridArray = DB::table('oldwork')->where('status',0)->where('game_id',$totalgameId[$i])->get();
    array_push($playeridArray, $playeridArray);
 }

this is about i search wallet ID, and under it have few game ID. And i need to use game ID to search all data about these game ID.

Thank you

13 May
11 months ago

kankai started a new conversation Centos Server Web Service Fail To Start

Hi guys,

I'm very new to server side. When i try to start web service in server, it happen error.

May 13 16:30:13 ip-xxx.ap-southeast-1.compute.internal httpd[21930]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
May 13 16:30:13 ip-xxx.ap-southeast-1.compute.internal httpd[21930]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
May 13 16:30:13 ip-xxx.ap-southeast-1.compute.internal httpd[21930]: no listening sockets available, shutting down
May 13 16:30:13 ip-xxx.ap-southeast-1.compute.internal httpd[21930]: AH00015: Unable to open logs
May 13 16:30:13 ip-xxx.ap-southeast-1.compute.internal systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
May 13 16:30:13 ip-xxx.ap-southeast-1.compute.internal kill[21931]: kill: cannot find process ""
May 13 16:30:13 ip-xxx.ap-southeast-1.compute.internal systemd[1]: httpd.service: control process exited, code=exited status=1
May 13 16:30:13 ip-xxx.ap-southeast-1.compute.internal systemd[1]: Failed to start The Apache HTTP Server.
May 13 16:30:13 ip-xxx.ap-southeast-1.compute.internal systemd[1]: Unit httpd.service entered failed state.
May 13 16:30:13 ip-xxx.ap-southeast-1.compute.internal systemd[1]: httpd.service failed.

May i know how can i fix this? Currently i can view my laravel application in this server.

03 May
11 months ago

kankai left a reply on From Javascript Var Set As Php Var

ok, thank you guys. Will try it out with ajax

02 May
11 months ago

kankai left a reply on From Javascript Var Set As Php Var

@Nash Any example so that i can pass JS var to php back end?

kankai left a reply on From Javascript Var Set As Php Var

i echo out $verifyKey[0] = ed1298251521cf6e84d60b77c8d1793f and then echo $verifyCode also = ed1298251521cf6e84d60b77c8d1793f But cannot meet if equal condition

kankai started a new conversation From Javascript Var Set As Php Var

Hi guys,

I'm creating a web verification thru javascript localstorage, the idea is create a localstorage 'code' in a browser and insert to server mysql.

So that when user open this web, browser will get localstorage 'code' and check with mysql. If 'code' exist then user can open this page, else return to error page.

But when i write until verify function, the verify 'code' is the same but IF condition cannot get it.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script>
// Check browser support
if (typeof(Storage) !== "undefined") {
    var verifyKey = localStorage.getItem("private_key");
    <?php $verify = "<script>document.write(verifyKey);</script>"; ?> 
} else {
    alert("Sorry, your browser does not support Web Storage...");
}
</script>

<?php 
   $verifyCode = $verify;

for ($i=0; $i < sizeof($verifyKey); $i++) { 
      if ($verifyKey[$i] == $verifyCode) {
        echo $verifyKey[$i]." ||| ".$verifyCode;
      }
    }   
?>
30 Apr
11 months ago

kankai left a reply on Mysql_fetch_array Undefined Function

@arukomp Problem solved, thank you very much!

kankai left a reply on Mysql_fetch_array Undefined Function

if i change it to mysqli_fetch_array, it will be given this error message. mysqli_fetch_array() expects parameter 2 to be integer, string given

kankai started a new conversation Mysql_fetch_array Undefined Function

Previously i had build a code redeem website with php old version, but then i upgraded php version to 7. After that i found mysql fetch array function has been removed. What should i need to change in my code?

$sql = "SELECT * FROM code_redeem WHERE redeemCode='$promoCode'";

$result = mysqli_query($connection,$sql)or die('error getting data'); $num_rows = mysqli_num_rows($result); if ($result->num_rows == 1) { while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { if($num_rows==1){ if($row['used']==1){ echo "alert('Code has been used');"; }else{ $sql = "UPDATE code_redeem SET used='1', user= '$userName', contactNo= '$contactNo',email= '$email', browserName= '$browserName', browser= '$browser', location= '$location', regDate= '$regdate', device= '$device' WHERE redeemCode='$promoCode'"; if ($connection->query($sql) === TRUE) { //echo "Record updated successfully"; } else { //echo "Error updating record: " . $connection->error; } require_once ('run/start.php'); return; } } } }

22 Apr
1 year ago

kankai started a new conversation Get Latest Data Issue

Hi,

I created a web that recording all amount that goes in and out. But when my connection is lagging or maybe other issue, i can't get latest data from server and it goes wrong.

the database is something like this: amount_in | capital +10.00 | 10.00 +2.00 | 12.00 +2.00 | 12.00 +3.00 | 15.00

As you can see sometime, it cannot get latest capital from database. What can i do to solve this problem? Thanks

19 Apr
1 year ago

kankai started a new conversation Suspect Laravel In Server Have Problem

Hi,

Recently i just create a web in linux server by using laravel framework, but create several function i found that sometime this web will down/ lagging.

I have try to ping server when it's lagging, the ping result is normal. Ping time around 12ms

Any way that can check my laravel framework has install complete or checking the framework error?

Thank You

14 Apr
1 year ago

kankai started a new conversation Set Timezone In Mysql

Hi Guys,

I have set config.php and .env to Singapore timezone but when i insert query it still insert wrong timezone.

I have changed setting in files below app.php : 'timezone' => env("APP_TIMEZONE", "Asia/Singapore"), .env : APP_TIMEZONE=Asia/Singapore

And also when i trace out the time in php it show me correct timezone: Carbon @1523689074 {#189 ▼ date: 2018-04-14 14:57:54.559117 Asia/Singapore (+08:00) }

phpMyAdmin time that inserted: 2018-04-13 23:57:47

Anything i have missed out?

kankai started a new conversation Check Computer Unique Id

Hi Guys,

I'm building a website that only allow office's computers access, but i did a research found out php cannot detect computer MAC Address. Any other unique id that php can detect or javascript can detect?

04 Apr
1 year ago

kankai left a reply on Avoid Spam On Post Action

@lostdreamer_nl Thank You very much, problem solved =)

kankai started a new conversation Avoid Spam On Post Action

Hi guys,

I have create a form that can submit a number into database, but i found out user will spam on it. When user use keyboard to hit enter few times, it will submit several time and insert data to database. Any way to avoid this? Can it be after submit form, user will prevent click on submit in a second?

27 Mar
1 year ago

kankai left a reply on Local Server Routes 404 Not Found

Thanks for reply, i solved it with modify documenRoot.

DocumentRoot "/var/www/html/laravel/public/"

<Directory "/var/www/html/laravel/public"> Allowoverride All

kankai left a reply on Local Server Routes 404 Not Found

I'm using Apache/2.4.6 (CentOS) , and ya i need to use port 8080.

kankai started a new conversation Local Server Routes 404 Not Found

Dear all,

I have set up a centOS server in my office, after install laravel in that server i found out all routes are not found.

IP of server: http://192.168.0.68:8080 Error Message: The requested URL /login was not found on this server.

I have tried create .htaccess in it but still can't solve the problem.

.htaccess code: <Directory /var/www/html/> Options Indexes FollowSymLinks AllowOverride All Require all granted

Thanks for help