1 Best Reply Awards

  • Member Since 3 Years Ago
  • 275 Lessons Completed
  • 2 Favorites

4th June, 2017

IvanBernatovic left a reply on Delay Between Processes In Job Queue • 1 year ago

@Ali_Ali I'm facing same issue with Amazon API and I also agree that this is the best way to go :)

29th May, 2017

IvanBernatovic started a new conversation How To Add Missing Migrations And New Data Model To Production Application • 1 year ago

So, I got to work on Laravel Spark application that's not finished yet but it's used by customers on production. Quality of the code is poor and it seems that previous developers weren't familiar with Laravel. So in result nothing works completely and it's extremely hard to fix things as there were no conventions followed regarding anything (no code styling, no comments, no SOLID principles on mind, 200+ lines for a method, no taste in general).

However, biggest issue with the app is that there are no migrations for database and database scheme is not usable at the moment. So I started to redesign database model and created all missing migrations and some of the Eloquent models. Now problem is that I need to find a way how to apply new scheme and use migrations. For instance, some tables already exist so migration will fail.

My plan is this:

  1. Extract all of the data from tables that have no migration file to some easily readable format (can be SQL dump, Laravel seed file or even CSV); let's call it old_scheme_backup
  2. Drop those tables
  3. Create new tables using migrations
  4. Write a script that will populate newly created tables with the data from old_scheme_backup
  5. Problem solved

So, do you have any suggestion what's the best approach for problems like this?

27th March, 2017

IvanBernatovic left a reply on JWT With Laravel 5.1 • 1 year ago

@mr415 I think this is not how it works. If you're storing JWT in a cookie then you really need to implement CSRF.

Scenario: you have a site with paying transactions and you implemented JWT authentication, you are storing JWT in a cookie. You don't have any kind of CSRF protection. Your user is logged in and his valid JWT is stored in a cookie. Some malicious site has a form and he wants to exploit your endpoint for making transaction (on behalf of user). He'll make a form with irrelevant inputs and action will be your transaction endpoint. When user submits the form, browser will make a request with all the cookies stored for your domain (including your cookie which contains JWT). So, since your JWT is valid and you have no CSRF protection that request will be valid and that is considered as a security issue for the user.

17th July, 2016

IvanBernatovic started a new conversation One-To-Many Polymorphic Relationship • 1 year ago

Has anyone done a 1:n polymorphic relationship before? The docs only describes a 1:1 or n:n polymorphic relationship.

A customer can have multiple tags (and other customer can have the same tag) A timelog can have multiple tags (and other timelogs can also have the same tag)

17th February, 2016

IvanBernatovic left a reply on How Can I Combine "styles" Mix In With "sass" Mix When "gulp Watch"? • 2 years ago

@renedekat Hmm, I don't know. Maybe it's your path syntax (./ part), try using paths without "./". If that doesn't help then add your own watcher in gulpfile, something like this. Let us know if something worked for you.

28th December, 2015

IvanBernatovic left a reply on Laravel 5.2 Currently Sitting About 25% Faster Than Laravel 5.1 • 2 years ago

@toniperic Yep, I will probably update project after all.

Pozdrav pozdrav :D

25th December, 2015

IvanBernatovic left a reply on Laravel 5.2 Currently Sitting About 25% Faster Than Laravel 5.1 • 2 years ago

@jekinney Thanks for reply. Fair point. I am aware that companies use older technologies because transition to newer stuff is expensive and risky of breaking functionality ( = losing money). I get your point that developers are the one who have most responsibility for security concerns you mentioned. But that didn't completely answered my question so I will rephrase it: In this specific scenario where I am comparing LTS version and non-LTS version with more features and better performance, what is wiser to value, or how much LTS support matters for Laravel-based projects?

IvanBernatovic left a reply on Why Session Is Not Working In Laravel 5.1 • 2 years ago

I don't know why, but you can't get data from Session if you are var_dumping (or dd()) it, but if you directly return then it works. Bottom line, for intended use it works.

P.S. In documentation it is used 'put ' method instead of 'set,' so keep that in mind.

IvanBernatovic left a reply on Chained 'remove' Task Is Not Executing With 'gulp Watch'. • 2 years ago

Hello again :) Try to register a watcher as demonstrated in docs https://laravel.com/docs/5.1/elixir#writing-elixir-extensions in section Custom Watchers.

In your last question you used module 'laravel-elixir-remove' and that suggests me that you have older version of Elixir. I recommend updating Elixir to major version 4 and using this package https://www.npmjs.com/package/laravel-elixir-delete for deleting files and folders with Elixir. However, I didn't test it out so be cautious.

IvanBernatovic left a reply on Laravel 5.2 Currently Sitting About 25% Faster Than Laravel 5.1 • 2 years ago

What do you think, for bigger projects (aimed for longer service life of at least 5 years) that are still in early development on Laravel 5.1), is it worth getting 25% more speed with 5.2 at the expense of long term support? I'm not interested in new features of 5.2 (at least not for existing project in development). I know it really depends on project s purpose and requirements but I'm interested to hear opinions.

IvanBernatovic left a reply on How Can I Combine "styles" Mix In With "sass" Mix When "gulp Watch"? • 2 years ago

@chrislentz Does it run other tasks after 'sass' task? Is this your usual workflow (or to rephrase: is is it ever worked four you with similar setup)? Does 'gulp' command behave like expected or is it only happening with 'gulp watch'? Have you tried updating Elixir to latest version?

24th December, 2015

IvanBernatovic left a reply on How Can I Combine "styles" Mix In With "sass" Mix When "gulp Watch"? • 2 years ago

Try to chain your methods on the same mix object?

var elixir = require('laravel-elixir');

var base_src  = 'resources/assets';
var base_dest = 'public/assets';

elixir(function(mix) {

    // Cleanup Destination

    // Compile SASS
    .sass('main.scss', base_src + '/css/main.css')

    ], base_dest + '/css/all.min.css', base_src)

    // Compile Scripts
    ], base_dest + '/js/all.min.js', base_src)

    // Copy Static Assets
    .copy(base_src + '/images', base_dest + '/images')
    .copy(base_src + '/bower/font-awesome/fonts', base_dest + '/fonts')

    .remove(base_src + '/css/main.css');

20th December, 2015

IvanBernatovic left a reply on Parent Child Communication And Data Sync Problem [Vuejs] • 2 years ago

@Hebilicious I made it work with computed properties. Problem wasn't in global filters object, it was line javascript Vue.config.debug = true;, it works without that line. Thanks for help!

19th December, 2015

IvanBernatovic left a reply on Parent Child Communication And Data Sync Problem [Vuejs] • 2 years ago

@Hebilicious In my case, 'filters' is just global object that contains helper methods so Vue instance doesn't get bloated with boring algorithms. Sort of like here https://github.com/tastejs/todomvc/blob/gh-pages/examples/vue/js/app.js#L7-L21

I agree with you on events, I would avoid them for my case. I tried to use shownProducts as a computed property but couldn't make it work. So, this is the code right now: https://jsfiddle.net/Jasterrr/ux1j0an9/ . I have shownProducts but I can't use it. console throws error. I will explain:

First I will directly list products that are received from API (v-for:"product in products"). As expected, these products do not reflect changes made in filters. In my VueDevtools I can see object shownProducts and it says computed; it's data changes as it should be when you uncheck vendor. Here's the picture: alt text

I want to use that shownProducts computed propertybecause it is data i need but if I write v-for:"product in products" I get errors: alt text

Problem is, when I'm using this computed property for listing I get errors (It seems that it can't access to data object of Vue instance then), but when I'm not using it it has right data. What a bummer. What to to now?

IvanBernatovic started a new conversation Parent Child Communication And Data Sync Problem • 2 years ago

This is a repost from Vuejs forum, I'm posting here in hope more people will see it here since this is bigger forum.

Hello, I have problem with my application. First I'll explain what I'm trying to achieve. I'm building interactive catalog of products on sale (from multiple vendors) where users have option to filter down products based on selected categories, vendors, search term, product sale date range etc. This is personal project for practice but who knows.

My main Vue component is responsible for fetching all data from API. As of now, I only implemented fetching vendors and products. Main component has two child components: <products> and <filters>. Products component is responsible for listing products, and filters component is responsible for user input (checkboxes for categories and vendors, etc.).

Main idea is this: send appropriate data from main component to child components (that is, send product objects as prop to products component and vendors objects as prop to filter component). When user change something from filters, for example checks/unchecks specific vendor, reflect that in product listing, that is only show products from vendors that are checked.

For now it's almost working for me. Vendors object that belong to main component are sent to filters component.

<filters :vendors.sync="vendors"></filters> 

so it's two-way binded data. When user checks/unchecks vendor event is dispatched in vendor component so the main component knows that filter data has changed and it needs to calculate which products to show.

<input type="checkbox" class="filled-in"
       v-on:click="updateProducts" />
<label v-bind:for="vendor.id">{{ vendor.name }}</label>
module.exports = {
    props: ['vendor'],
    methods: {
        updateProducts: function () {
            console.log("Vendors checked/unchecked");

In main component there is event handler called filtersChanged, you can inspect whole main component here: https://jsfiddle.net/Jasterrr/vtuco5s4/. You can see that first it is created new array of only checked vendors, and than that array (together with all products array) is sent into method that returns products that belong only to selected vendors and stores it in shownProducts object which belongs to data object. Problem is this: method that checks which vendor is checked gets older data (one state older). Result is following: at initial state all vendors are checked and all products are shown. When user uncheck some vendor object data changes, but product listing is still the same. When user check that vendor back, now we can see change in product listing (all products except ones that belong to that vendor are shown) but that isn't wanted behaviour.

See problem in images:

  1. Initial state: alt text

  2. Unchecking first vendor (left side), no changes in products listing alt text

  3. Checking again, however too late alt text

My questions are:

  1. What am I doing wrong here?
  2. Is this the right architecture (main component holds all the data and send it to other components)?
  3. How can I improve my app?

There's no doubt that I am JavaScript and Vue newbie. This code looks bad and I know it. But this is very early phase of application so I hope I will improve my JS and Vue skills and make it better.

Thanks for help!

9th June, 2015

IvanBernatovic left a reply on Laravel 5.0 => 5.1 Upgrade • 3 years ago

Thanks again guys, it just seemed too easy so I had to check :)

IvanBernatovic started a new conversation Laravel 5.0 => 5.1 Upgrade • 3 years ago

Hello everybody, I have basic question and I just want to be sure that everything goes well. I want to upgrade my project from 5.0 to 5.1, so in order to upgrade I must go to composer.json, in "require" I should change from "laravel/framework": "5.0." to "laravel/framework": "5.1." or "laravel/framework": "5.1.0", follow these steps: http://laravel.com/docs/5.1/upgrade#upgrade-5.1.0 , and that's it? Thanks for help!

28th April, 2015

IvanBernatovic left a reply on ERR! EEXIST When Trying To Npm Install Laravel Elixir • 3 years ago

I have the same error. I'm using Windows 8.1 32-bit, no VM's. I have installed nodejs, gulp etc., in fact it had worked projects before and there were no errors. Here's error:

c:\XAMPP\htdocs\film>npm install --save-dev
npm WARN package.json @ No repository field.
> node-sass@2.1.1 install c:\XAMPP\htdocs\film\node_modules\laravel-elixir\node_modules\gulp-sass\node_modules\node-sass
> node scripts/install.js

> node-sass@2.1.1 postinstall c:\XAMPP\htdocs\film\node_modules\laravel-elixir\node_modules\gulp-sass\node_modules\node-sass
> node scripts/build.js

`win32-ia32-node-0.10` exists; testing
Binary is fine; exiting
npm ERR! EEXIST, open 'C:\Users\Ivan\AppData\Roaming\npm-cache\b4512796-adable-stream-1-0-33-package-tgz.lock'
File exists: C:\Users\Ivan\AppData\Roaming\npm-cache\b4512796-adable-stream-1-0-33-package-tgz.lock
Move it away, and try again.

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js"
"install" "--save-dev"
npm ERR! cwd c:\XAMPP\htdocs\film
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR! path C:\Users\Ivan\AppData\Roaming\npm-cache\b4512796-adable-stream-1-0-33-package-tgz.lock
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! not ok code 0


Error: Cannot find module 'laravel-elixir'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (c:\XAMPP\htdocs\film\gulpfile.js:1:76)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)

Can someone help me please?

15th April, 2015

IvanBernatovic left a reply on Lumen • 3 years ago

Yep, same problem as others, doesn't work with XAMPP out of the box so I'm using artisan serve for the time.

Edit Your Profile

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