Luka

Experience

1,140

0 Best Reply Awards

  • Member Since 1 Year Ago
  • 7 Lessons Completed
  • 0 Favorites

22nd February, 2018

Luka left a reply on Problem To Create Dependable Dropwdown With Ajax And Vue.js • 1 day ago

Sorry Bobby, done it now. I did not see that option.

21st February, 2018

Luka left a reply on Problem To Create Dependable Dropwdown With Ajax And Vue.js • 2 days ago

@bobbybouwmann Thank You !!! That works indeed. I tried it with int and that was wrong. You were right, the URL showed false and true before, it now works fine. Thank you so much for your help !!

Luka left a reply on Problem To Create Dependable Dropwdown With Ajax And Vue.js • 2 days ago

Ok, I see what you mean. I have tried different ways, but I can not find a way to cast my boolean into an integer. This is my vue component: What do I need to change?

  <form action="/tasks" method="post">
       Public
        <input type="checkbox" name="publicval" v-model="publicval" @change="loadCategories" >
        <br>
      Member
        <input type="checkbox" name="memberval" v-model="memberval" @change="loadCategories" >           
        <select  name="category_id">
            <option value="">Select Category</option>
            <option v-for="category in categories" :value="category.id">{{ category.category }}</option>
        </select>
        <button type="submit" class="btn btn-primary">Submit</button>
</form>

  export default {
    data(){
        return {
            categories:[],
            publicval: 0,
            memberval: 0,
        }
    },
    mounted() {       
       // this.loadCategories()
    },
    methods:{
        loadCategories(){
           let url = '/categories/'+this.publicval+'/'+this.memberval
           this.dynamicDropdown(url,'categories')
        },
        dynamicDropdown(url,data){
            axios.get(url)
                 .then(response=>this[data]=response.data)
                 .catch(error=>console.log(error))
        }
    }
}

19th February, 2018

Luka left a reply on Problem To Create Dependable Dropwdown With Ajax And Vue.js • 4 days ago

I am not sure I understand what you mean. The

  $publicval = true;
  $memberval = false;

is just an example to test if that works. Where do I have to do the change?

Luka left a reply on Problem To Create Dependable Dropwdown With Ajax And Vue.js • 4 days ago

Is this a real thing? this[data]?? To be honest? No idea. I found it on internet. The URL works.

If I do the below as an example, then I get the right values from my db. What does not seem to work is sending over the state of the 2 checkboxes. In my db I use 0 and 1. So is this an error in my vue component?

public function categories($publicval,$memberval)

{ $publicval = true; $memberval = false; return Categories::where('public','=', $publicval)->where('memberarea','=', $memberval)->get(); }

Luka started a new conversation Problem To Create Dependable Dropwdown With Ajax And Vue.js • 4 days ago

I am trying to program a dependable dropdown with Vue, Ajax and Laravel. The dropdown is depending on 2 checkboxes. I have created a Vue component:

<template>
<div class="container">
   
    <div class="row">
    <form action="/tasks" method="post">
    Public
        <input type="checkbox" name="publicval" value="1" v-model="publicval" @change="loadCategories" >
        <br>
      Member
        <input type="checkbox" name="memberval" value="1" v-model="memberval" @change="loadCategories" >           
        <select  name="category_id">
            <option value="">Select Category</option>
            <option v-for="category in categories" :value="category.id">{{ category.category }}</option>
        </select>
        <button type="submit" class="btn btn-primary">Submit</button>
</form>
    </div>

export default { data(){ return { categories:[], publicval: '0', memberval: '0' } }, mounted() {
       // this.loadCategories()
    },
    methods:{
        loadCategories(){
           let url = '/categories/'+this.publicval+'/'+this.memberval
           this.dynamicDropdown(url,'categories')
        },
        dynamicDropdown(url,data){
            axios.get(url)
                 .then(response=>this[data]=response.data)
                 .catch(error=>console.log(error))
        }
    }
}

I have the following route:

Route::get('categories/{publicval}/{memberval}', '[email protected]');

In my Controller I have the following method:

public function categories($publicval,$memberval)
{
    return Categories::where('public','=', $publicval)->where('memberarea','=', $memberval)->get();
}

Unfortunately it does not work. When I check the Headers the Request URL show /categories/true/false when I click on the first checkbox, but the result is wrong. What do I do wrong? Is it the Route or Vue.js? This is my first approach with Vue, so it is very likely that I do it wrong....

14th February, 2018

Luka left a reply on Laravel 5.6, Bootstrap 4 + Template, JQuery And Vue • 1 week ago

Now I am lost. I assumed that with using:

npm install package name
npm run dev 

The packages are then available to use in my project so I wont have to link to them via CDN. What is the node_modules folder with all the libraries then for?

Luka left a reply on Laravel 5.6, Bootstrap 4 + Template, JQuery And Vue • 1 week ago

Ok, that is actually what I thought and it means I will have to upload the node_modules folder to the webserver as well in the end. So just to confirm, any files in node_modules I can just leave in there and do not need to copy them into any other folder? And I do not need to use:

  <script src="https://cdnjs.cloudflare.com/ajax/libs/flexslider/2.7.0/jquery.flexslider.min.js"></script>

or

in my blade layout file? I still get the "popper is not defined" error and I think jQuery is still not working, so right now flexslider is not working so I can not test if I need to add that link or now. Do I have to do anything else after the below 2 to be able to use a package?

npm install package name
npm run dev

13th February, 2018

Luka left a reply on Laravel 5.6, Bootstrap 4 + Template, JQuery And Vue • 1 week ago

@Heyaj05, Thank you so much for your help. I just don't understand what the nodes_modules folder does. For example I have done a npm install flexslider. After that I had a folder called Flexslider in my nodes_modules folder, but what do I now actually do? Do I copy the folder from there into my public/js folder or is it supposed to do that automatically when I run npm run dev? Is there anything I have to change in rescources/assets/js/app.js to call up flexslider or is it just in the blade template?

Luka left a reply on Laravel 5.6, Bootstrap 4 + Template, JQuery And Vue • 1 week ago

As described in my first post, I created a new Laravel Project. I then went into that directory and run npm install. This created me a folder called node_modules with all the packages.

Luka left a reply on Laravel 5.6, Bootstrap 4 + Template, JQuery And Vue • 1 week ago

Yes, that is all installed and when I run "npm run dev" it comes back with successfully compiled. I just do not know how to include for example flexslider and jQuery/UI. I also still get mapping error for bootstrap and popper, besides when I uncomment sourceMappingURL in the app.js but then I get the "popper is not defined" Error, so I run into different issues here.

Luka left a reply on Laravel 5.6, Bootstrap 4 + Template, JQuery And Vue • 1 week ago

I still got the same problem and I am not sure how to solve it. It is also not clear if I actually have to copy all the Javascript files into my public folder or if that should happen automatically if I do npm run dev which does not happen right now... any advice anyone? Or maybe I good Tutorial for Laravel 5.6?

9th February, 2018

Luka left a reply on Laravel 5.6, Bootstrap 4 + Template, JQuery And Vue • 2 weeks ago

I actually noticed that I got an Error when i add

<script src="{{ asset('js/app.js') }}"></script> 

The Error shows Source-Map-Error bootstrap.js.map

So I found in public/js/app.js the line

//# sourceMappingURL=bootstrap.js.map

I removed the //# the Error changes to popper.js mapping Error, so I found again an entry for popper and removed again the //# which fixed that Error, but unfortunately I get a new Error "popper is not defined"

I am not quite sure what I am missing here. As I said what I am trying to be able to use Bootstrap 4, jQuery/UI, Flexslider.js and Vue.js. Any help to get it up and running in Laravel 5.6 would be fantastic.

Luka left a reply on Laravel 5.6, Bootstrap 4 + Template, JQuery And Vue • 2 weeks ago

Thank you. Excellent, but what about jQuery/UI? I suppose that is not available yet is it? Do I have to download it or use a CDN link? I also want to use extra scripts like flexslider. What do I do with them? Do I download them manually and upload them into the public folder and use below link or is there any other way?

<script src="{{ asset('js/flexslider/jquery.flexslider.js') }}"></script>

Luka started a new conversation Laravel 5.6, Bootstrap 4 + Template, JQuery And Vue • 2 weeks ago

I am trying to learn Laravel. I started with Laravel 5.5, but have re-started now with a clean new install of Laravel 5.6. I need Bootstrap 4 and jQuery as well as Vue. I have to admit that I struggle to understand Node and how to install everything. I did the following. I went into c:\xampp\htdocs\ and run laravel new blog this created me a directory with all the Laravel files. I then went into that directory and run npm install. This created me a folder called node_modules with all the packages. After that I run npm run dev. Apparently this compiles my SASS and the resources/assets/js/app.js file. After that I run php artisan make:auth which created me the app.blade in resources\views\layouts in there I have 2 entries:

 <link href="{{ asset('css/app.css') }}" rel="stylesheet">
 <script src="{{ asset('js/app.js') }}"></script>

Stupid question, do I still have to download the Bootstrap Files into the public folder manually and use

etc plus for all my other files or do I misunderstand something? Apparently Laravel 5.6 includes Bootstrap 4 so how can I just use that?

Luka left a reply on Laravel 5 And Angular • 2 weeks ago

Does make me wonder more and more if I should maybe stick to learn Laravel and Vue first. Specially since I am still not fully familiar how it all works with nodes, bower, sass etc.

I tried so much out with my first project that I wonder if all these files and folders are actually needed, so maybe I should start again with now Laravel 5.6 and get Bootstrap 4, jQuery and vue.js running...

Luka left a reply on Laravel 5 And Angular • 2 weeks ago

Yes, I have read a few comments like that, but I am trying to widen my knowledge and I thought it would be a good idea to learn Laravel and Angular at the same time. Not sure this is the best idea indeed.

Luka left a reply on Laravel 5 And Angular • 2 weeks ago

Thank you. I have read many different tutorials, but to be honest I am still not clear about it how to do it. Lets say I already got my Laravel Blog Project in C:\xampp\htdocs\blog

If I understand right then I first need to run npm install -g @angular/cli ? Do I have to do it in that directory or do I have to create a Subfolder for it? And when I have done that, is Angular then installed for my Laravel Blog Website? Sorry for the stupid questions, but the tutorials I found are all rather confusing.

7th February, 2018

Luka started a new conversation Laravel 5 And Angular • 2 weeks ago

I am just starting with my first project in Laravel. I normally use jQuery for all sort of Frontend Activity and AJAX, but I now thought that it would be a good idea to also learn a Frontend Framework. I am aware that Laravel has got Vue implemented, but there seems to be a higher demand for Angular knowledge, so I would like to use that. My first task is to create a dependable Dropdown, so I want to use a simple AJAX request to fill a dropdown from a database with Angular. At a later stage I want to create a file upload, but for now I just need to be able to do that simple task. My project is already up and running and its multiple pages with ACL/Auth etc, so I have to now install Angular in an existing project. Is all this possible? Anyone knows of an easy tutorial to do that normally simple task?

10th January, 2018

Luka left a reply on Set Permission For Different Methods In Controller When Using Spatie\Permission • 1 month ago

Thank you very much. Unfortunately I seem to have a problem with the | as soon I add

''' $this->middleware(['auth', 'isSuperAdmin|isUserAdmin']); '''

I get an Error Message that the class not exists. If I just check for 1 Role it works. Any idea what that could be?

''' Class isSuperAdmin|isUserAdmin does not exist '''

Luka started a new conversation Set Permission For Different Methods In Controller When Using Spatie\Permission • 1 month ago

Hi all, I am still rather new to Laravel and I am trying to set up my first project. I needed a Role/Permission set up and have installed Spatie Permission. I have created different roles and each role got different permissions. I would now like to set up a permission check inside the controller to allow access for a specific role. The role is "User Admin", but I do not want to allow the User Admin to delete any User which can only be done by the "Super Admin". I also got different Levels for writing News, so I will have a "News Owner" and a "News Editor" and only the News Owner will be allowed to publish. I want the check done in the Controller, but I do not understand how that works. I am able to have a "Permission denied" for the complete Controller, if I add this in my Controller, by I want it for specific Methods only.

public function __construct() {
        $this->middleware(['auth', 'isSuperAdmin']); /
}

Can someone give me a hint how that works?

21st October, 2017

Luka left a reply on Dropdown Menu Laravel 5 • 4 months ago

I am totally new to Laravel as well and I just tried to achieve the same, read out a Navigation from the database. I have installed secrethash/dropmenu. It sounds like that it will have everything I need. I want a top Main Navigation (collapsible with the Children) and each Page should show the Children Navigation on the left side. I want a Navigation for the Footer and I need one for the Admin and Members Section so I would need different Users-rights. secrethash sounds great, but... I have followed the installation, but have no idea how to place it now in my views.... is there any Tutorial out there anywhere where I could read it up?

25th April, 2016

Luka left a reply on How To Build Dynamic Query For Eloquent Model And Pass To View • 1 year ago

Thank you very much for your reply. I just realised that I would have to subscribe to watch a Video lesson. I am sorry that I did not realise this before, I thought this is just a Laravel Forum. Anyway, maybe I will be able to find something about Query String Filtering, since this seems to be the direction you wanted me to look at. Thank you very much again for this.

Luka started a new conversation How To Build Dynamic Query For Eloquent Model And Pass To View • 1 year ago

Hi everybody,

I have just started to learn Laravel 5 and hope my question is not too stupid. I am trying to achieve the following. I have 3 tables adverts categories advert_category

In my categories table I have main and subcategories. So parent categories have got parent_id NULL otherwise they show the id of the parent. When I save a new advert, I have the advert_id and the category_id saved in the pivot table advert_category. All that works fine. I am now trying the following. I want a Navigation with Maincategories and Subcategories shown. When I click on a Subcategory then I can read out easily the advert_id's from the advert_category table, because I am only looking for only 1 category_id, but I now plan to be able to click on the Maincategory and now show all the Adverts which belong to all the Subcategories from this Maincategory. So my approach is the following:

// Look up if passed id is found under parent_id column $cat = Category::where('parent_id', $id)->get();

// The chosen category is a maincategory, 
// therefore build dynamic where to look for all the id's 
if (count($cat) > 0)
{    
    $query = Category::select();
    foreach($cat as $value) {
        $query->orWhere('id', '=', $value->id);
    }
    $advertList = $query->get();     
}
else{
    $advertList = Category::findOrFail($id);
}
return view ('publicpage.adverts.showall',['advertList' => $advertList->adverts]);

Unfortunately, when I go on the Maincategory, I get below error. When I go on the Subcategory, I get the adverts shown.

Undefined property: Illuminate\Database\Eloquent\Collection::$adverts

A dd($advertlist) brings the following result:

Clicked on Maincategory:

Collection {#203 ▼
#items: array:2 [▼

0 => Category {#204 ▶}

1 => Category {#205 ▶}
] }

So it shows Collection.

Clicked on Subcategory

Category {#201 ▼

#table: "Categories"

#connection: null

In the View, I try to print it out like this: @foreach($advertList as $advertDetail) {{ $advertDetail->title }}
@endforeach

I get the adverts printed for the subcategory, but as I said an Error when I click on the maincategory, which involves multiple subcategories. Where is my mistake? In the Controller or the way I try to access the information in the view? Could someone help? Thank you in advance.

Edit Your Profile
Update

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