thusfar

Experience

16,590

0 Best Reply Awards

  • Member Since 2 Years Ago
  • 141 Lessons Completed
  • 1 Favorite

8th January, 2017

thusfar left a reply on Add New Payment Method In Spark • 1 year ago

@marknuyens Yes, it is possible to integrate other payment gateways with Spark. I've done it myself (2Checkout and Paymill).

They don't come right out of the box with Spark, but if you have any knowledge of Laravel and PHP it shouldn't be an issue.

Also, you would have to modify VueJS code a little bit.

Regards

6th November, 2016

thusfar left a reply on Is JSON File In Use? • 1 year ago

I decided to do this. Wait until lock is removed from the file and then write to it. Is this a good solution?

while(!flock($path, LOCK_EX)){ }
Storage::put($path, \GuzzleHttp\json_encode($notifications), true);

thusfar started a new conversation Is JSON File In Use? • 1 year ago

What if I make API request to my server where I write to file, but the file is in use (another request to the same api writing to the same file)? Is this taken care of by Laravel or do I have to write my own PHP logic for that??

Regards

20th October, 2016

thusfar left a reply on RAM Usage History For Ubuntu Server?? • 1 year ago

Anything with GUI? Something that shows graphs on your domain that you set?

thusfar left a reply on Laravel Events: Authenticated V Login? • 1 year ago

It seems like I'll have to guess.

thusfar started a new conversation RAM Usage History For Ubuntu Server?? • 1 year ago

I'm looking for a tool that monitors RAM usage and can show RAM usage history on Ubuntu servers??

Is anthing like available?

thusfar started a new conversation Laravel Events: Authenticated V Login? • 1 year ago

What's the difference between Authenticated and Login built in Laravel events? Is there any place where I can see description of these built in events?

16th October, 2016

thusfar started a new conversation How To Send Custom StatusText On HTTP Exception Response?? • 1 year ago

So I'm using Vue and Laravel. Withing the Vue code I make $http requests to Laravel API. If something goes wrong inside API Closure, I simply send HTTP Exception so that Vue can execute error callback, instead of success callback. But I noticed one thing, which I dont know whether its common or not.

In Chrome, statusText is shown as I set it in example below. In Firefox that same statusText is set to "Forbidden" which is normal for 403 HTTP code. In Chromium statusText is "". In LG Android browser statusText is "OK".

WTF? What is the point of setting statusText, if it doesnt work?

I send error in statusText so that I can display it with Vue to my user, but obviously this is not a good idea, so I need some other way to do this.

$response = new \Illuminate\Http\Response();
                return $response->setStatusCode(403, trans('api.website_limit_reached'));

Chrome https://www.dropbox.com/s/8i4bfxguy4dji6m/Screenshot%202016-10-17%2001.42.49.png?dl=0

Chromium https://www.dropbox.com/s/2ehib6q5cbrrkvh/Screenshot%202016-10-17%2001.43.12.png?dl=0

Firefox https://www.dropbox.com/s/mjnc5pu7dfg1p8n/Screenshot%202016-10-17%2001.43.42.png?dl=0

thusfar started a new conversation SSL .htaccess The Right Way? • 1 year ago

I'm hosting my website on Cloudways. I noticed that when I use .htaccess below, response->statusText is always null and also redirect->back is always set to root domain instead of the previous domain.

I think this .htaccess is causing problems to my code. Can someone tell me how the correct .htaccess for Laravel should look like? Also forcing https and non-www??

Regards

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.eu [NC]
RewriteRule ^(.*)$ http://example.eu/$1 [L,R=301]

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]


<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

thusfar started a new conversation Response Returns Empty StatusCode Even If Set!?? • 1 year ago

I'm trying to return 403 HTTP Exception like this

return (new \Illuminate\Http\Response)->setStatusCode(403,
                    trans('api.website_limit_reached'));

Then I print response in Javascript (it's ajax call to api) and in that response statusText is not set, altough it is set in php code as you can see. I've tried to replace 'trans()' with normal text, but statusCode was still empty when received in Javascript. But when I change 403 to 404 or anything else, changes are immediately visible in JS response.

Any ideas to why this is happening?

Regards

5th October, 2016

thusfar left a reply on Auth Login POST (with Wrong Credentials) Redirects To Home? • 1 year ago

I just realized that when I submit login form HTTP_REFERER is set to my root domain. That is also the case with logout route.

Any idea why would HTTP_REFERER be set to root domain???

4th October, 2016

thusfar left a reply on Auth Login POST (with Wrong Credentials) Redirects To Home? • 1 year ago

I dont have a problem with succesfull login. I have a problem when the login is unsuccessful.

thusfar left a reply on Auth Login POST (with Wrong Credentials) Redirects To Home? • 1 year ago

It's not an empty project and I switch from Route::auth() to my custom definitions. They are the same and plus they have a name as you can see in the first post.

thusfar started a new conversation Auth Login POST (with Wrong Credentials) Redirects To Home? • 1 year ago

I defined Auth routes and now they look like this below. When I go to login page and I submit wrong credentials I get redirected to home (root domain) route instead of back to login page so that errors could be displayed.

I dd() $request inside login() method inside LoginController and the referrer is my root domain. Is that okay?

I dd() "redirect()->back()" from "sendFailedLoginResponse" function and it shows root route as the targetUrl. That's not okay.

Also, I cleared my routes with artisan. POST route inlogin.blade.php is defined correctly.

I'm not sure what exactly is going on. Do you guys have any ideas or suggestions??

$router->group([
    'middleware' => [
        'web',
    ],
], function($router) {
    $router->group([
            'as'        => 'auth::',
            'namespace' => 'Auth',
        ], 
        function ($router) {
            // Authentication Routes...
            $router->group(['prefix' => 'login', 'as' => 'login.'], function ($router) {
                // auth::login.get
                $router->get('/',  ['as' => 'get',  'uses' => '[email protected]']);
                // auth::login.post
                $router->post('/', ['as' => 'post', 'uses' => '[email protected]']);
            });

            // auth::logout
            $router->get('logout', ['as' => 'logout', 'uses' => '[email protected]']);

            // Registration Routes...
            $router->group(['prefix' => 'register', 'as' => 'register.'], function ($router) {
                // auth::register.get
                $router->get('/',  ['as' => 'get',  'uses' => '[email protected]']);
                // auth::register.post
                $router->post('/', ['as' => 'post', 'uses' => '[email protected]']);
            });
        }
    );
});

30th September, 2016

thusfar left a reply on Call To Undefined Method Illuminate\Database\Query\Builder::save() • 1 year ago

Well it seems like I dont have. But when I dont then Phpstorm doesnt offer "where" in autocomplete. But it seems, it works without all().

29th September, 2016

thusfar started a new conversation Call To Undefined Method Illuminate\Database\Query\Builder::save() • 1 year ago

So I'm using Spark and I want to retrieve a user so I do the following but I get the error

Call to undefined method Illuminate\Database\Query\Builder::save()

These are classes I include:

use Illuminate\Http\Request;
use App\Http\Requests;
use Laravel\Spark\Spark;
use Twocheckout;
use Twocheckout_Sale;
use Twocheckout_Error;
use Laravel\Spark\Subscription;
use Laravel\Spark\LocalInvoice;
use App\User;

Here is how I retrieve User model.

        $user = User::all()->where('email', $data['user_email'])->first();

I cannot do this.

        $user = User::where('email', $data['user_email'])->first();

It has to have ::all()

And then when I try to save

$user->save();

PhpStorm says the method doesnt exist.

What am I doing wrong???

17th September, 2016

thusfar left a reply on The Best Localization Plugin For Laravel? • 2 years ago

I went with this one https://github.com/ARCANEDEV/Localization

Seems to be having a way better support

14th September, 2016

thusfar started a new conversation The Best Localization Plugin For Laravel? • 2 years ago

What is the best localization plugin for Laravel??

9th September, 2016

thusfar started a new conversation How To Implement Something Other Than Braintree Or Stripe? • 2 years ago

I would like to know whether it's possible to implement something other than Braintree or Stripe and most importantly what are the steps that needs to be done??

I would appreciate if someone can give me some guidelines on this one.

Regards

20th July, 2016

thusfar started a new conversation Big Response Time When Making Request To Outside API?? • 2 years ago

On the frontend I have AJAX form. In the controller that is called on submit of that form I make 2 API calls to the outside API. When I do that, the response for the first API call takes 20s.

        clock()->startEvent('3', '3');
        $res = $taxamo->validateTaxNumber("AT", $vat_id);
        clock()->endEvent('3');

        clock()->startEvent('1', '1');
        $country_code = $taxamo->locateGivenIP($ip_address)->country_code;
        clock()->endEvent('1');

        clock()->startEvent('2', '2');
        $res = $taxamo->validateTaxNumber($country_code, $vat_id);
        clock()->endEvent('2');

I only use events 1 and 2. I've added event "3" just to prove that it's not "locateGivenIP" fault and that only the first call to the outside API takes 20 seconds. Also Taxamo has operation logs and it says there that their server responed in 2ms. So its not their fault either. I tried to make API call to Braintree. It also takes 20 seconds.

It worked perfectly few days ago (short response time), but all of the sudden this problem appeared. I'm really wondering why. Trust when I tell you that I only made small changes to 1 controller and I'm sure that is not a cause of the problem. But then again, problems dont appear by themselves.

When I try to update data on some other AJAX form where controller doesnt make outside API calls, it is exxecuted in ~1s.

I've googled this issue but I havent found anything that could be related to my problem.

I use Cloudflare, maybe that could be a problem?? I've tried php artisan optimize --force and no luck. Also my project is live on Vultr $20 server. Maybe it's their fault?

Funny thing that every outside API call takes 20s. Sometimes, really rarely 5s.

CLOCKWORK PIC https://www.dropbox.com/s/2orc5i37o337nn5/Screenshot%202016-07-20%2019.30.51.png?dl=0

thusfar started a new conversation How To Validate Provided Country Code? • 2 years ago

Spark has built in CountryValidator which is basically just a class.

I'm wondering how can I use that custom validator with Validator::make??

18th July, 2016

thusfar left a reply on Vue - How To Add A New Field To Form? • 2 years ago

Are you sure? Because gulpscript takes files from /vendor.

Maybe you will say that if Spark gets updated, my changes would be overwritten. True, but I dont really care.

Altough, you could tell how would I make these changes in

\resources\assets\js\spark-components\settings\profile\update-contact-information.js

thusfar left a reply on Vue - How To Add A New Field To Form? • 2 years ago

I finally got it working. It appears it was cache issue. Before I posted here I emptied cache and did a hard reload, but it wasnt working. Now after some time it works. Btw. I'm using Cloudflare. Maybe this will help someone someday.

thusfar started a new conversation Vue - How To Add A New Field To Form? • 2 years ago

So I want to add new field to Update Contact Information form.

I open file /vendor/laravel/spark/resources/assets/js/settings/profile/update-contant-information.js and I make this changes:

data() {
        return {
            form: $.extend(true, new SparkForm({
                name: '',
                email: '',
                isBusiness: 0 // new line
            }), Spark.forms.updateContactInformation)
        };
    },
ready() {
        this.form.name = this.user.name;
        this.form.email = this.user.email;
        this.form.isBusiness = this.user.isBusiness;  // new line
    },

And then I run Gulp. However these new lines are not visible in app.js after gulp is compiled.

Why? And how to make this work?

17th July, 2016

thusfar started a new conversation Laravel TTFB Nearly 1s • 2 years ago

I'm using Clockwork for debugging. I have landing page and dashboard section page.

On my landing page Total Execution time is 121ms with Clockwork and on Network tab TTFB is 185ms.

With my Dashboard page Total Execution time is 886ms with Framework Running 839ms and TTFB 998ms. Based on Clockwork there are 4 DB queries, all of them finished in under 1ms. And all that route (/dashboard/) does is it return a view.

Why is this happening and what should I do to improve/fix it?

16th July, 2016

thusfar started a new conversation How To Use Custom PHP Plugin With Laravel?? • 2 years ago

I need to install this PHP package and use it with Laravel.

https://github.com/taxamo/taxamo-php

Once I installed it with Composer how can I use it inside Laravel since it is not Laravel package?

Regards

10th July, 2016

thusfar left a reply on How To Integrate Taxamo In Spark? • 2 years ago

But how would I handle VAT percentage dynamically in Spark since Im using Braintree?? And plus, I'm using subscription plans.

Can you give me a more insight on how would I accomplish this with Spark using VAT calculator?? Not the frontend, but the backend, because the price of the selected plan has to be set automatically. Is it possible to send dynamic price to Braintree?

thusfar started a new conversation How To Integrate Taxamo In Spark? • 2 years ago

Is there anyone who could explain how to integrate Taxamo (Braintree as gateway) in Spark???

First, one would integrate Taxamo checkout form. But what with the backend??

I know that Spark doesnt support Taxamo, but I'm willing to do hardcoding inside Spark.

P.S. Maybe it's not appropriate to post it here, but if there is someone who knows how to integrate Taxamo with Spark, but is not willing to do it for free, then let me just say that I'd be willing to pay that someone to do it for me.

8th July, 2016

thusfar left a reply on What Is The Fastest Way To Make HTTP Requests??? • 2 years ago

It is the opposite. I want send data to Intercom to log actions for analytics. User signed up, visited this page, that page, did that, and so on. Basically log all their actions.

To do that I have to send HTTP requests to their API. That's at least one outgoing http request for each route I have. Now, while doing that in php functions (in controller), I dont want that making those http requests affects the loading speed of my views/website. So I want to make sure it won't.

7th July, 2016

thusfar started a new conversation What Is The Fastest Way To Make HTTP Requests??? • 2 years ago

I'm new to PHP, coming from JS. I would like to know what is the fastest way to make HTTP requests in PHP???

PHP is synchronous, so that would mean that it doesnt continue executing code until it gets back response when using cURL?? Am I right?? If so, how could I avoid that my website gets slow if http response takes to long?

6th July, 2016

thusfar left a reply on Composer Error When Trying To Install Laravel Tracker • 2 years ago

None. Composer.json was reverted to the previous state. At least that's what it says on the screenshot I provided.

thusfar left a reply on Composer Error When Trying To Install Laravel Tracker • 2 years ago

I ran it from cmd: composer require pragmarx/tracker

thusfar started a new conversation Composer Error When Trying To Install Laravel Tracker • 2 years ago

I'm trying to install this package on my Laravel 5.2

https://github.com/antonioribeiro/tracker

But then I get this error:

https://www.dropbox.com/s/qbbtu4jahd0n6kv/Screenshot%202016-07-02%2009.41.31.png?dl=0

What should I do?

Regards

2nd July, 2016

thusfar started a new conversation Suggestions On How To Handle VAT If Using Braintree? • 2 years ago

What are some ways on how to handle VAT if using Spark and Braintree??

I thought maybe to use Geolocation and based on country use the plans in SparkServiceProvide. If country is Germany use this plan, if it is Austria use the other plan and so on. Of course, each plan would be defined in Braintree dashboard. Unique plan for Germany, unique plan for Austria and so on. And I could apply VAT as an AddOn in braintree.

Of course this has downsides if user is using proxy or something like that, but hey, at least something.

What do you think? Would that work in Spark?

Do you maybe have some other suggestions??

Regards

1st July, 2016

thusfar started a new conversation Hints For First Time Users Plugin? • 2 years ago

When a user registers to my page I would like to show him hints/helpers on how to use my website. Is there any good plugin for Laravel to handle this?

29th June, 2016

thusfar started a new conversation Catch Exceptions And Request Data? • 2 years ago

How can I catch any exception related to my routes that would usually be written in log file regardless of whether debugging is turned off or on?? Plus, how could I catch request data from when that exception occured??

thusfar left a reply on You Do Not Own Any Licenses For Release • 2 years ago

Of course I bought the license. Otherwise I wouldnt post here.

thusfar left a reply on Big Controller File? • 2 years ago

Because I think that would be faster than querying DB? Or should put it in separate files and then load matching file?

thusfar started a new conversation Big Controller File? • 2 years ago

So I have Controller file, it's called ApiController. I have an array that contains JSON data. That array has 9 keys and each key has 4000-5000 lines of JSON. Inside api functions, only I'm checking if value sent through the request is in this JSON (from only one key), so checking inside 4000-5000 lines.

Anyhow, because I have that array with JSON that currently is 32000 lines long, my controller is 19kB in size right now.

Is that bad? If so, how bad it is? How much would loading ApiController slow down my app since it's 19kB. It's relatively big. And yeah, I expect that that JSON will grow to over 200k lines. Should I use DB or should I separate JSON keys into files and then when I receive value from user's request, load json from a file with the same name as value?

Regards

25th June, 2016

thusfar left a reply on TokenMismatchException In VerifyCsrfToken.php Line 67 • 2 years ago

It is repetable on Login screen/view.

But I found something interesting. On login view, VueJS code is loaded and on each load there is AJAX request made to the API endpoint route. That endpoint requires 'auth' middleware so of course on Login screen it returns 401 (Unauthorized) because it is not authenticated. Logic.

When I remove that route from routes.php everything works fine. Good to know. I fixed my problem.

But I'm still interested to why that happens. So if AJAX call on Login screen returns 401 (Unauthorized), you submit form and you get TokenMismatchException in VerifyCsrfToken.php line 67 errror.

Whats is the logic behind it?

thusfar started a new conversation TokenMismatchException In VerifyCsrfToken.php Line 67 • 2 years ago

So I'm using Spark. And I've been using it for days working on my project. No problem.

Today, I power up Homestead, visit my website, try to login and I get: TokenMismatchException in VerifyCsrfToken.php line 67

Just out of the blue.

I get this error on POST /login route, which is defined by Spark and which is defined INSIDE 'web' middleware. I logged in many times without issues.

Now, I searched this topic here on forums, on google, even Spark github repository. Tried many solutions I've found, but no help.

What I've tried:

  • check if my "login" route uses 'web' middleware
  • clearing cache
  • generating new key
  • putting all of my routes inside 'web' middleware
  • checking if _token was send during POST request
  • checking the 'login' view for the usage of CSFR which is defined like this {{ csrf_field() }}

Although, I've noticed inside POST request on 'login' route that these two are different. Maybe they should be? I'm not sure.

// inside request headers
Cookie:XSRF-TOKEN=eyJpdiI6IkZIVUJ2RURlMXhpOThDN3llUWNabFE9PSIsInZhbHVlIjoiQ3hNalZ0Zjh2MnBVSm9HdnpWSzFcL1ZrbVkwNXlZQUVqbGVUd2JGNUNhOTgyZ1ZERjhPQU5Uczdhb2FTQVRQY3U2TXYyZTVVNXplYklZWmdpSnN4U1h3PT0iLCJtYWMiOiJmNGMzZjZhNmI5NjQ1ND ....to be continued
// form data
_token:KFymm26nxRJXiWctbGnZuNwkgioHLr4beYNxfVts

23rd June, 2016

thusfar left a reply on Using Greater Or Less Than With Equal On Where Doesnt Work!? • 2 years ago

How can I do that? Maybe using Log?

thusfar left a reply on Using Greater Or Less Than With Equal On Where Doesnt Work!? • 2 years ago

I switched to DB::table...... and it works. But, still. Why doesnt work with Eloquent?

thusfar left a reply on Using Greater Or Less Than With Equal On Where Doesnt Work!? • 2 years ago

Yes, I am. It should. I checked the data dozen times. Like I said, for example if I use just the first where clause, it works. When I put '=' inside it. It doesnt work.

thusfar left a reply on Using Greater Or Less Than With Equal On Where Doesnt Work!? • 2 years ago

When I remove all those "where" statements that contain '<=' or '>='. Everything works. Then I add '=' to the first query and it doesnt work. Like WTF? Like Eloquent cant use the conditions!?

thusfar left a reply on Using Greater Or Less Than With Equal On Where Doesnt Work!? • 2 years ago

I updated the first post with column types

thusfar started a new conversation Using Greater Or Less Than With Equal On Where Doesnt Work!? • 2 years ago

Here is my query

        $numberOfTheSameFilters = $filters->where('user_id', $user->id)
                                            ->where('website_id', $websiteID)
                                            ->where('col1', $filter["col1"])
                                            ->where('col2', $filter["model"])
                                            ->where('col3', $filter["fuel"])
                                            ->where('col4', '<=', $filter["col4"])
                                            ->where('col5', '>=', $filter["col5"])
                                            ->where('col6', '<=', $filter["col6"])
                                            ->where('col7', '>=', $filter["col7"])
                                            ->where('col8', '<=', $filter["col8"])
                                            ->where('col9', '>=', $filter["col9"])
                                            ->count();

For me this query doesnt work, but it should. When I remove '<=' and '>=' from where clauses, then it works? When I have anything, even '=', it doesnt work.

What's wrong with that? How can I fix it?

22nd June, 2016

thusfar started a new conversation How Can I Add My Own Vue Router To Spark Application? • 2 years ago

How can I add my own Vue router to Spark application?

I'm new to Vue, so if someone could explain it to me.

Thanks

thusfar left a reply on Composer Autoload_static.php Error • 2 years ago

I have done that many times, but the error is not going away.

thusfar started a new conversation Composer Autoload_static.php Error • 2 years ago

autoload_static.php file which is located in vendor/composer directory is giving me the following error.

https://www.dropbox.com/s/l0puc5n3ju2075h/Screenshot%202016-06-22%2009.57.54.png?dl=0

How can I remove this error?

Regards

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.