kinshara

kinshara

Member Since 4 Years Ago

Jakarta

Experience Points 1,865
Experience Level 1

3,135 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 3
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.

09 Sep
1 week ago

kinshara left a reply on Log Permission Denied

thank you for the response.

lemme try first. I will update soon I got the result.

how can you find or set your webserver user "www"? actually I dont even know, is mine "www" or "www-data"

kinshara left a reply on Log Permission Denied

Sorry, I didnt give more information about the application.

I use laravel 5.5 for this application, there is no Logging Config File in app.

"You can put root and www-data in the same group then make the logfile group writable?" Even, I put the cron inside

cron -u www-data -e

still, the log that created by the Cron contains "root" name..

kinshara started a new conversation Log Permission Denied

I have my Web Application host in Linux by Nginx. there is some process running:

  1. Queue job triggered by dispatch.
  2. Cron to the scheduler that runs every minute.

Logging Configuration is Daily. And inside bootstrap/app.php I configure this

$app->configureMonologUsing(function(Monolog\Logger $monolog) {
    $filename = storage_path('logs/laravel-'.php_sapi_name().'-'.get_current_user().'.log');
    $handler = new Monolog\Handler\RotatingFileHandler($filename);
    $monolog->pushHandler($handler);
});

Every day the log created with "root" name from get_current_user(). and every new day, if the new log file created by Cron, the Queue job will not work because Permission Denied writing the log file.

I tried to fix, by adjusting the Cron by installing as www-data user install inside

crontab -u www-data -e

by the log file still, create with "root" name.

and then I tried inside the Cron command, I add

* * * * * -u www-data php /directory/to/my/application/artisan schedule:run

the only solution that I know for now, only change the permission to 755 every day or every time the error occurred.

is there any other solution?

22 Apr
4 months ago

kinshara started a new conversation Laravel 5.5 Queue Redis

I have some my application dispatch a job. But everytime it has dispatch, I must wait more than 1 minutes(have not had same interval) until the job is executed.

has someone experienced this thing? I want it to execute the job immediately at background.

04 Oct
1 year ago

kinshara left a reply on Need To Process 10k Records In Same Time.

Yes. it will works for bulk insert. I do this for 4k elements each time. You should commit only after complete a task. In case of an error you don't habe a corrupted dataset.

thank you :D. but it havent answered the main problem.. i cannot calculate all..

kinshara left a reply on Need To Process 10k Records In Same Time.

Is productDetail a relationship? Did you eager load it?

nope for this code. but I have already change with to load at once by view. is it really effect much?

I would use a queue for calculations like this. They can run in the background and don't have a execution time limit like normal http requests have.

I need to give response directly after it done..

Laravel commits after each action. So do only a commit after finnishing all.

will it works will bulk insert?

and i do confuse, when I process > 10k, the respond will return 404.

but if <10k, it recalculated successfully.

kinshara left a reply on Need To Process 10k Records In Same Time.

$deleteProductPriceID   = [];
        $productPrice           = [];
        $newLog                 = [];

        foreach($products as $product) {
            $productID  = $product->productDetail->id;
            $price      = $product->productDetail->price;

            foreach($custGroups as $group) {
                array_push($deleteProductPriceID, $productID);

                $markup = $price + (($price * $group->markup_percentage) / 100);
                $markup = ceil($markup / 100) * 100;

                array_push($productPrice, [
                    'product_id'        => $productID,
                    'customer_group_id' => $group->user_group_id,
                    'price'             => $markup,
                    'updated_at'        => $dateNow,
                    'created_at'        => $dateNow,
                ]);

                array_push($newLog, [
                    'product_id'        => $productID,
                    'customer_group_id' => $group->user_group_id,
                    'price_preset_id'   => $pricePreset->id,
                    'product_price'     => $price,
                    'markup_percentage' => $group->markup_percentage,
                    'admin_id'          => $adminID,
                    'updated_at'        => $dateNow,
                    'created_at'        => $dateNow
                ]);
            }
            ProductPriceModel::whereIn('product_id', $deleteProductPriceID)->delete();
            ProductPriceModel::insert($productPrice);
            ProductPriceLogModel::insert($newLog);
        }

I use 2 loops,

  1. loop all products,
  2. loop all group inside each products

kinshara started a new conversation Need To Process 10k Records In Same Time.

I have 20k records products data. and 4 customer groups, and each record of product data have 4 price based on customer groups.

and once single customer group is modified, the system need to recalculate 20k records(deleting old one, select base price, calculate the new price, and then insert new one) or may be just update.

if there are new products by import.. 9k products, it means 9k, looping each, and recalculate base on 4 groups and insert.

but the process is really slow, and sometimes my server(im using ubuntu, n nginx) going to 404 not found. is there any tips?

*i have already use bulk insert. storing them into array and insert at the end.

13 Jan
2 years ago

kinshara left a reply on Model Relationship With Multiple Other Models

how do you connect product group with pricing scheme?

are you trying to make 1 product - 1 pricing scheme due to its group?

kinshara left a reply on VPS Ram 2 GB Almost Run Out Memory

@ohffs thank you.. I do glad to hear that :)

kinshara left a reply on VPS Ram 2 GB Almost Run Out Memory

@ejdelmonico my friend told me because I use apache instead of nginx. and as I saw there is more than 5 apache task when I check by using "top". is this true?

and does using swap memory make load slower?

             total       used       free     shared    buffers     cached
Mem:       2049936    1686924     363012      29232     142976    1176860
-/+ buffers/cache:     367088    1682848
Swap:            0          0          0

is my server's status showing good condition?

@davidfaux thanks for the link, does that free in buffer/cache row is available for application? can it be use only for "apache" things?

but now, which one x_x.. I do confuse, which one is better and why? sorry if I asked too much. thank you for your time and for the answers.

11 Jan
2 years ago

kinshara started a new conversation VPS Ram 2 GB Almost Run Out Memory

I have my website hosted in Digital Ocean wtih 2 GB Memory, 2 Core Processors. and currently only 1 website inside.

top - 02:16:59 up 27 days, 20:22,  1 user,  load average: 0.08, 0.16, 0.15
Tasks:  94 total,   2 running,  92 sleeping,   0 stopped,   0 zombie
%Cpu(s):  3.0 us,  1.3 sy,  0.0 ni, 95.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   2049936 total,  1714208 used,   335728 free,   136520 buffers
KiB Swap:        0 total,        0 used,        0 free.  1193200 cached Mem

I used Ubuntu + Lamp. my website currently using laravel 5.0 and I set nohup queue:listen inside.

is my server status normal? my ram 1,7 Gb used. and my free memory only 300Mb++.. what will happend if the memory run out?

14 Dec
2 years ago

kinshara left a reply on Laravel 5.0 Auth Login Problem

thankk you. it's my mistakeee... its different between user and member

11 Nov
2 years ago

kinshara left a reply on Mail Later Takes Too Much Time.

I have already managed the queue by using database as the driver. but now the problem is I still confuse about the different between queue:listen and queue:work --daemon.

I read, its better to use queue:work --daemon. but all I doubt is, will it seek and fire another queue after the first one fired until no more job?? and will it stop and exit after that? or it will standby like queue:listen?

if it only fire first queue, how can I set it to finish all queue? if not only the first, the next one is, will it stop or exit after that? if stop & exit, I can use cron job to run queue:work --daemon. but the problem will it overlap occured? if not exit or stop, thats mean it standy like queue:listen, how can I set in cpanel and where must I set this event?

thank you.

kinshara left a reply on Mail Later Takes Too Much Time.

I think I still use Sync for queue driver.. is that good? but I read that Sync driver is for local use only, is it true that with Sync driver it will still run the process immediately? anyway, Im still using Laravel 5.0

kinshara started a new conversation Mail Later Takes Too Much Time.

Hi guys, I am developing e-commerce website which it send an email after registration. that feature took so much time for user to move on to next step. I tried to figure it out. and I got it. it is Mail function

Mail::later(5, $view,$email_data, function($message) use($to,$subject){
            $message->to($to)->subject($subject);
        });

whenever I put this code to comment, the process will be done immediately. and it works the opposite way. the most weird one, this only occurs for the first time. but later when I tried to buy and the system will send again, this time will so fast.

I use sendgrid for my mail host. I really have no more idea how can this be happen.

Please help. Thank you for your time.

31 Jan
3 years ago

kinshara left a reply on Laravel 5.0 Auth Login Problem

My session from Auth gone.. I was checking with Auth::member()->check(); and it returned me false..

but when I tried to print out Auth::member()->check(); in here

if(Auth::member()->attempt(['email'=> $email, 'password'=>$password, 'is_active'=>1])) {
            dd(Auth::user()->check());//it works well here
            return Redirect::intended('home');
        }

it returned true

kinshara started a new conversation Laravel 5.0 Auth Login Problem

here is my code

public function _do_login($email, $password) {
        if(Auth::member()->attempt(['email'=> $email, 'password'=>$password, 'is_active'=>1])) {
            dd(Auth::user()->check());//it works well here
            return Redirect::intended('home');
        } else {
            return Redirect::back()->with('login_error', 'Wrong email and password combination.');
        }
    }

but when it has already redirect to home. that Auth gone.. i use multi auth sboo

30 Jan
3 years ago

kinshara left a reply on Advice About Security Of System That Holding Cc Number/money Value

I always afraid to make system that can store balance to the system.. but i want to try... at the first, i was trying to make website with default member.. whenever they want to upgrade their membership, the system can directly charge them.. thats why, if my system can hold their cc detail, they can just click, and let my system do the thing.. and also if they store some balance, the system can charge them directly. but the thing, is it secure enough?

i heard about ssl certificate, i dont know how will it affect the security..

kinshara left a reply on Advice About Security Of System That Holding Cc Number/money Value

how about store value point of money, balance or something like that?

kinshara started a new conversation Advice About Security Of System That Holding Cc Number/money Value

I want to develop website with a system that can hold CC number and they can use to pay with it easily.. But I still beginner about storing money value or cc number inside my system(still affraid about the security).

any advice for me?

this whole time I only use third party to charge them(eq paypal via api), but my system didnt save any value of their money/cc number.

thank you for your time.. im really looking for it..

24 Jun
4 years ago

kinshara left a reply on Uploadify

@jimmck yes it's blade file... it just wont send to server because the token not equals (thats mean not pass to verifyCsrfToken)... but it passed and works smoothly if i use it on chrome

kinshara left a reply on Uploadify

$('#fileupload').uploadify({
            'swf'           : '{{ URL::asset($asset_path."uploadify/uploadify.swf")}}',
            'uploader'      : '{{ URL::to("_admin/product_image?act=upload&id=".$data->id)}}',
            'buttonText'    : 'BROWSE...',
            'fileTypeDesc'  : 'Image Files',
            'fileTypeExts'  : '*.gif; *.jpg; *.jpeg; *.png',
            'formData'      : {'_token':'{{ csrf_token() }}'}
});

it works well on chrome, but idk why it is not working on firefox

kinshara left a reply on Uploadify

@jimmck I have add it, it works well now on chrome, but still miss token on firefox

@ikmadushan how can i add the header? is it javascript?

kinshara left a reply on Uploadify

i found out Laravel 5.0 TokenMismatchException with uploadify on firefox only on firefox,,

23 Jun
4 years ago

kinshara started a new conversation Uploadify

$('#fileupload').uploadify({
    'swf'           : '{{ URL::asset($asset_path."uploadify/uploadify.swf")}}',
    'uploader'  : '{{ URL::to("_admin/product_image?act=upload&id=".$data->id)}}',

if i access direct from the url, it will return {"success":true,"status":"yes"} but when i try to upload by using uploadify, it gives me http error 500 *im using laravel 5

22 Jun
4 years ago

kinshara left a reply on Model OrderBy Method Not Exist

@bobbybouwmann lol! it works thanks bro.. i realized it actually, but i use wrong Model thats why it wont found any method.. lol..

@phildawson well, the methods are inherited from Models controller..

kinshara started a new conversation Model OrderBy Method Not Exist

i have my parent controller

class Parent {
    public $model;

    public function test() {
        return $this->model->orderBy();
    }
}
//and then my controller
class foo extends Parent {
    public function index() {
        $this->model = new homeModel;
    }
}

i got that orderBy method not found

21 Jun
4 years ago

kinshara left a reply on Laravel 5 Admin Structure

Route::get('/_admin/login', array('as'=> 'admin_login', 'uses'=>'Login@index'));

can i set the uses to the others namespace?

kinshara left a reply on Laravel 5 Admin Structure

@gwp because i have front developer and back developer, and i dont want they see each others works.. and i can give them instruction and fetch their data(controller model views assets) easily without must check if there is any additional script in this model..

kinshara left a reply on Laravel 5 Admin Structure

@nfauchelle what if i want to separate them? what should i do?

kinshara left a reply on Laravel 5 Admin Structure

@gwp I was thinking to separate them, so in the future if there is a new member here, they can easily just look into that one folder. without looking to the front...

@nfauchelle how about the model? will they use the same model with the front's using one?

kinshara started a new conversation Laravel 5 Admin Structure

I want start to make my back end site using laravel 5.. i just wondering to make another laravel inside laravel project?

but i think it will use much space of data because there will be 2 core of laravel.. can i just put my controller, model, view, and assets there? but the core of laravel still using the one that the front end is using now?

14 Jun
4 years ago

kinshara left a reply on Mailchimp Create Lists By API

hmm cant we just make our own list db, and send it by mandrill(it's mailchimp too)??

13 Jun
4 years ago

kinshara left a reply on Facebook API

@bobbybouwmann, i have no idea what happened there, but someone tell me "try to force the user to facebook login url again", i tried that, and i just found it works!, but idk if it will completely works or not..

try {
    $response = $request->execute();
    $me = $response->getGraphObject();
} catch (FacebookRequestException $ex) {
    echo $ex->getMessage();
} catch (\Exception $ex) {
    // I do force redirect the user to facebook login url again, and TADAAA!! it works! amazing.
    echo $ex->getMessage();
}

I do really thank you and appreciate everybody's effort and response.. :)

kinshara left a reply on Facebook API

I tried the once again.. tatchi.kansaicoatings.co.id <- here is the link.. i use one facebook account,

i print out this one..

$session = $helper->getSessionFromRedirect();
//i print_r, and exit;

first, i tried on firefox (my laptop), it returned

ModeFacebook\FacebookSession Object ( [accessToken:Facebook\FacebookSession:private] => Facebook\Entities\AccessToken Object ( [accessToken:protected] => *here is the token* [machineId:protected] => [expiresAt:protected] => ) [signedRequest:Facebook\FacebookSession:private] => ) 

second, i tried on chrome (android mobile phone), it returned null..

kinshara left a reply on Facebook API

@bobbybouwmann here in my index.php

session_start();
use Facebook\FacebookSession;

FacebookSession::setDefaultApplication(Config::get('facebook.AppID'), Config::get('facebook.secret'));

i tried to remove session_start(); but it returns error.

@martinbean yeah, but i dont know what must to do... because I have already 38 players registered and play smoothly without any bugs. but suddenly, bad news come, several players cannt login by facebook,, same script, but facebook return empty..

the samething also on my phone. I tried to login with my account by desktop browser, it ran smoothly,, but when i tried on my phone, facebook didnt return any.

kinshara left a reply on Facebook API

I just wonder, some players work perfectly, but some players dont work(it got those error)

12 Jun
4 years ago

kinshara left a reply on Facebook API

@bheath , @martinbean the error is so long,,,
argument 1 passed to facebook\FacebookRequest::__construct() must be an instance of Facebook\FacebookSession, null given, called in this line error $user_profile = (new FacebookRequest($session, 'GET', '/me'))->execute()->getGraphObject(GraphUser::className())->asArray();

kinshara started a new conversation Facebook API

I build my simple game with facebook login, and then at the first several hours it ran smooth, until i got an bug.. whenever try to login, it say, there is error in my code

// here is in my home controller
public function index(){
        $params = array(
            'scope' => Config::get('facebook.scope')
        );

        $helper     = new FacebookRedirectLoginHelper(Config::get('facebook.redirect'));
        $loginUrl   = $helper->getLoginUrl($params);
        $this->data['loginUrl'] = $loginUrl;
        $this->render_view('home/home');
}


// when login, it redirect to my portal security,
$helper = new FacebookRedirectLoginHelper(Config::get('facebook.redirect'));
try {
    $session = $helper->getSessionFromRedirect();
        print_r($session);exit;
        Session::put('session',$session);

        try {
            $user_profile   = (new FacebookRequest($session, 'GET', '/me'))->execute()->getGraphObject(GraphUser::className())->asArray();

        if (!$this->userIsExist($user_profile['id'])) {
            $this->insertDB($user_profile);
            }

            Session::put('member',$user_profile);
            return Redirect::to('/ready');
    
    } catch(FacebookRequestException $e) {
        echo "Exception occured, code: " . $e->getCode();
            echo " with message: " . $e->getMessage();
    }
} catch(FacebookRequestException $ex) {
    //When Facebook returns an error
} catch(\Exception $ex) {
        //print_r($ex);
        // When validation fails or other local issues
}

when i run it, it will go to \Exception $ex section.. I doubt it was about the token,, but i dunno what to do... please help :(

kinshara started a new conversation Pagination In Laravel 5

I want to make my own style pagination.. in laravel 4.2

//in view
{{ $data->link('urlToView');
//my own view
<?php
    $presenter = new Illuminate\Pagination\BootstrapPresenter($paginator);
    $trans = $environment->getTranslator();
?>
<?php if ($paginator->getLastPage() > 1): ?>
    <ul class="own-pagination">
        <?php
            echo $presenter->getPrevious($trans->trans('pagination.previous'));
            echo $presenter->getPageRange(1, $paginator->getLastPage() );
            echo $presenter->getNext($trans->trans('pagination.next'));
        ?>
    </ul>
<?php endif; ?>

but when i tried laravel 5, it changed

$data->setPath('urlLink')->render();

but I dont know how to make my own style of pagination

04 Jun
4 years ago

kinshara left a reply on Singleton

@pmall it works!!!! Thank you guys.. love this community :D

kinshara left a reply on Singleton

use gsjathi\Systems\Controllers\Systems;

abstract class Controller extends BaseController {

    use DispatchesCommands, ValidatesRequests;

    public function __construct() {
        $config = Systems::getInstance();
    }
}

@kfirba I got error.. Non-static method.. did i miss something?

kinshara started a new conversation Singleton

I made widgets module, and Page class

when i load homepage, it will call several widgets to put in.. but the problem is the 2 widgets fetch the data from Page class.. and each widgets will create

$about = new Pages();
return $about->get('pages');
//first
$rules = new Pages();
return $rules->get('rules');

I wondered what if there is 3-4, it must create new Pages() 4 times,, is there any method for singleton?

kinshara left a reply on Dispatch Vs Create Instance

the burger king explanation really helping!! @JohnRivs Thank you so much!

kinshara left a reply on Dispatch Vs Create Instance

@JohnRivs Really thank you for your response..

and last one, is running in the background will make much difference? do you have any examples? I mean, do every logic eq like calculationMethod() must be moved to Commands too?

kinshara left a reply on Dispatch Vs Create Instance

In Laravel 5.1, commands are being renamed to Jobs, because they're meant to be queueable.

whooa,, is Laravel 5.1 is already release? and the queue, will it globaly queue the processes even several users hit it the same time(i meant like it will automaticly stack it with fifo)??

kinshara left a reply on Dispatch Vs Create Instance

I am trying to make modules by commands instead of abstract class(libraries). so for example i make

- App
    -System
        -Commands
            - configCommands
        -models

I use it for every time controllers construct, it will call configCommands, to get the config

<?php namespace gsjathi\Systems\Commands;

use gsjathi\Commands\Command;
use gsjathi\Systems\SystemsModel;

use Illuminate\Contracts\Bus\SelfHandling;

class SystemsCommand extends Command implements SelfHandling {

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {

    }

    public function load_config($reset = FALSE){
        $global_config = \Cache::get('config');

        if(empty($global_config) || $reset){
            $configs = SystemsModel::all();
            $global_config = array();
            foreach($configs as $config){
                $global_config[$config->name] = $config->content;
            }

            \Cache::put('config', $global_config, 86400);
        }

        return $global_config;
    }

    public function get($name){
        $global_config = $this->load_config();
        $result = "";

        if(isset($global_config[$name])){
            $result = $global_config[$name];
        }

        return $result;
    }

    /**
     * Execute the command.
     *
     * @return void
     */
    public function handle()
    {

    }

}

any suggestion?

kinshara left a reply on Dispatch Vs Create Instance

@JohnRivs can we select to certain Command's function with $this->dispatch()? like I use to use it

$cmd    = new Command();
$cmd->function();

and can it return something?