IvanBernatovic

Experience

9,325

1 Best Reply Awards

  • Member Since 1 Year Ago
  • 223 Lessons Completed
  • 1 Favorite

17th July, 2016

IvanBernatovic started a new conversation One-To-Many Polymorphic Relationship • 6 months 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"? • 11 months 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 • 1 year 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 • 1 year 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 • 1 year 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'. • 1 year 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 • 1 year 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"? • 1 year 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"? • 1 year ago

Try to chain your methods on the same mix object?

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

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

elixir(function(mix) {

    // Cleanup Destination
    mix.remove(base_dest)

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

    .styles([
        '/css/main.css',
        '/bower/font-awesome/css/font-awesome.min.css'
    ], base_dest + '/css/all.min.css', base_src)

    // Compile Scripts
    .scripts([
        '/bower/jquery/dist/jquery.js',
        '/bower/foundation-sites/dist/foundation.min.js',
        '/js/main.js'
    ], 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] • 1 year 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] • 1 year 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 • 1 year 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-bind:id="vendor.id"
       v-model="vendor.checked"
       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");
            this.$dispatch('filtersChanged');
        }
    }
}

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 • 1 year 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 • 1 year 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 • 1 year 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

c:\XAMPP\htdocs\film>gulp

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 • 1 year 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
Update

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