irankhosravi

irankhosravi

Member Since 1 Year Ago

Experience Points 8,340
Experience
Level
Lessons Completed 1
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

17 Jan
22 hours ago

irankhosravi left a reply on How To Show In Vue Tab

When I click Cars I want to display message in Vue devtools. While I do not want to display arrays.

Array

I want to show this

Vuejs

What do I want to show?

irankhosravi left a reply on How To Show In Vue Tab

When I click on Cars. I want to show this.

[![Vuejs][1]][1]

While I do not want to display arrays.

Arrays

What do I want to show?

irankhosravi left a reply on How To Show In Vue Tan

Answer my question.

16 Jan
1 day ago

irankhosravi left a reply on How To Show In Vue Tan

@TYKUS - Yes . I don't want to be hidden for now. but I want to display Cars Vue tab where I click On Cars.

irankhosravi started a new conversation How To Show In Vue Tan

I have a categories table with below picture.

Categories

When I click on Car I want to show below pic in developer tools on Vue tabs.

Vuejs

Categories

Advert.vue

<template>
    <div>
        <ul class="list-group">
            <li v-for="category in categories" @click="sendAdvert(category.id)" class="list-group-item display">{{ category.name }}</li>
        </ul>
        <!--<ul class="list-group">-->
            <!--<li class="list-group-item hide">{{ category.name }}</li>-->
        <!--</ul>-->
    </div>
</template>

<script>
    export default {
        props: ['categories'],
        data() {
            return {
                adverts: []
            }
        },

        methods: {
            sendAdvert: function (id) {
                const self = this;

                axios.post('adverts/', {
                    id: id
                }).then(response => {
                    this.adverts = response.data;
                    $(".display").hide()
                });
            }
        }
    }
</script>

web.php

Route::resource('adverts', 'AdvertController');

AdvertController.php

public function index()
{
    $categories = Category::orderBy('id', 'desc')->get();
    return view('Home.adverts', ['categories' => $categories]);
    //$categories = Category::where('parent_id', 0)->get();
    //return view('Home.adverts', compact('categories'));
}

public function store(Request $request)
{
    $id = $request->id;
    $category = Category::find($id);
    return $category;
}

web.php

Route::resource('adverts', 'AdvertController');

AdvertController.php

public function index()
{
    $categories = Category::where('parent_id', 0)->get();
    return view('Home.adverts', compact('categories'));
}

public function store(Request $request)
{
    $id = $request->id;
    $category = Category::find($id);
    return $category;
}
08 Jan
1 week ago

irankhosravi started a new conversation How To Create Simple RESTful API Using PHP And JSON _ PHP?

We are located on this page and receive and display information via api. I am a product specimen to they. Calculate the information according to the information it contains.

"id": 55,
"title": "test",
"alt_title": new product,
"slug": "test",
"description": test,
"price": 1000,
"image": http://.....jpg,
"status": 1,
"duration": 80,
"user_id": 1,
"views": 70,
"likes": 30,
"sales": 5,
"data": null,
"published_at": "2018-12-27 15:29:28",
"thumbnail": "http://.....jpg,",

You need to write the same html with php code Appear in the same way and using php Apply to addresses and information, for example, to display products

05 Jan
1 week ago

irankhosravi left a reply on How To Create Space When Create Multi Column With Bootstrap 4.2

@PATRICKSJ - Can you give a few lines of code for me?

Thanks.

irankhosravi left a reply on How To Create Space When Create Multi Column With Bootstrap 4.2

This will automatically render some space between the 2 divs.

columns

irankhosravi started a new conversation How To Create Space When Create Multi Column With Bootstrap 4.2

I use bootstrap 4.2

I have a four columns but I tried space in margin But I see sticking together.

enter image description here

I use class col, col-sm-3, card

<div class="row">
    <div class="bg-primary text-center p-5 col bg">
        <a class="text-white" href="">Car</a>
    </div>
    <div class="bg-info text-center p-5 col bg">
        <a class="text-white" href="">House</a>
    </div>
    <div class="bg-danger text-center p-5 col bg">
        <a class="text-white" href="">Mobile</a>
    </div>
    <div class="bg-warning text-center p-5 col bg">
        <a class="text-white" href="#">Laptop</a>
    </div>
</div>
29 Dec
2 weeks ago

irankhosravi left a reply on How To Open List Where Parent_id 1

when i clicked on the cars? i see this error.

parsed is undefined

12 Dec
1 month ago

irankhosravi started a new conversation How To Get The Reason Error In Console

I am working with vue.js and I want to get the reason error in console.log();.

How to should I do?

try {
    ....    
}
catch (error ex)
{
    console.log(ex.error)
}
11 Dec
1 month ago

irankhosravi left a reply on How To Open List Where Parent_id 1

I changed if but my problem have.

https://i.stack.imgur.com/18Ywb.png

axios.get('adverts/store/${id}').then((response) => {
    this.adverts = response.data;
}).catch((response) => {
    self.error = 1;
    console.log('Errors');
});

irankhosravi left a reply on How To Open List Where Parent_id 1

@BURLRESEARCH - Thanks for answer. But I want to click to open sub category. How to should I do?

Thanks in advance...

irankhosravi left a reply on How To Open List Where Parent_id 1

@BURLRESEARCH - Thanks for answer. But I want to click to open sub category. How to should I do?

Thanks in advance...

irankhosravi left a reply on How To Open List Where Parent_id 1

@BURLRESEARCH - Thanks for answer. But I want to click to open sub category. How to should I do?

Thanks in advance...

10 Dec
1 month ago

irankhosravi left a reply on How To Open List Where Parent_id 1

When I click 'Cars' I get 405 error.

Vuejs

irankhosravi left a reply on How To Open List Where Parent_id 1

I changed it but I did not see. I want see Cars then when I clicked on 'Cars' open Collapse menu.

  • Devil
  • Taz
09 Dec
1 month ago

irankhosravi started a new conversation How To Open List Where Parent_id 1

I have a categories table with below picture.

Categories

I want to when click on parent_id => 0 open collapse sub category with parent_id => 1.

Advert.vue

<template>
    <div>
        <h3>List of free ads</h3>
        <ul class="list-group">
            <li v-for="category in categories" :id="'select'+category.id " @click="sendAdvert(category.id)" class="list-group-item">{{ category.name }}</li>
        </ul>
    </div>
</template>

<script>
    export default {
        props: ['categories'],
        data() {
            return {
                adverts: []
            }
        },

        methods: {
            sendAdvert: function (id) {
                const self = this;

                axios.post('adverts', {
                    id: id
                }).then((response) => {
                    this.adverts = response.data;
                }).catch((response) => {
                    self.error = 1;
                    console.log('Errors');
                });
            }
        }
    }
</script>

web.php

Route::resource('adverts', 'AdvertController');

AdvertController.php

public function index()
{
    $categories = Category::orderBy('id', 'desc')->get();
    return view('Home.adverts', ['categories' => $categories]);

// $categories = Category::where('parent_id', 0)->get(); // return view('Home.adverts', compact('categories')); }

07 Dec
1 month ago

irankhosravi left a reply on How To Display Data In Vuejs With Laravel?

@REALRANDYALLEN - I changed it but it did not display.

irankhosravi left a reply on How To Display Data In Vuejs With Laravel?

@GLOBALS - I changed But it did not display.

irankhosravi started a new conversation How To Display Data In Vuejs With Laravel?

I am new, maybe I am asking simple question, but I don't find an answer. But I very need this solution. But I can not to display that. I dont know why, I tryed to find solutions, but I dont find a correct answer.

Advert.vue

<template>
    <div>
        <ul class="list-group">
            <li v-for="category in categories" class="list-group-item"> {{ category.name }}</li>
        </ul>
    </div>
</template>

<script>
    export default {
        props: ['data'],
        data() {
            return {
                name: "",
                parent_id: "",
                categories: this.data,
            }
        },
        methods: {
            adverts() {
                axios.post('adverts', {
                    name: self.name,
                    parent_id: self.parent_id,
                });
            }
        },
    }
</script>

web.php

Route::resource('adverts', 'AdvertController');

AdvertController.php

public function index()
{
    $categories = Category::all();
    return view('Home.adverts', compact('categories'));
}

adverts.blade.php

<div class="container mt-5">
    <h3>Display free adverts</h3>
    <Adverts></Adverts>
</div>
03 Dec
1 month ago

irankhosravi left a reply on Do Not Show Information's Of Vuejs In Laravel

@REALRANDYALLEN - When I typped http://localhost:8000/admin/categories in address bar I get this error.

Property [id] does not exist on this collection instance. (View: C:\xampp\htdocs\project\divar\resources\views\Admin\categories\index.blade.php)

irankhosravi left a reply on Do Not Show Information's Of Vuejs In Laravel

     $category = Category::pluck('id');

irankhosravi left a reply on Do Not Show Information's Of Vuejs In Laravel

I edited my post and deleted it but was deleted after refresh.

28 Nov
1 month ago

irankhosravi left a reply on Do Not Show Information's Of Vuejs In Laravel

@REALRANDYALLEN - My problem has not yet been resolved

irankhosravi left a reply on Do Not Show Information's Of Vuejs In Laravel

@REALRANDYALLEN - HI,

Thanks for answer. But I have a problem. When i replace line of from:

<form action="{{ route('categories.destroy', ['id' => $categories->id]) }}" method="post">

I get this error.

Property [id] does not exist on this collection instance. (View: C:\xampp\htdocs\project\divar\resources\views\Admin\categories\index.blade.php)

irankhosravi started a new conversation Do Not Show Information's Of Vuejs In Laravel

I want to display select categories but it does not display

DeleteCategory.vue

<template>
    <div>
        <div class="form-group">
            <label for="category">Category:</label>
            <select id="category" v-model="deletecategory" class="form-control">
                <option v-for="category in categories" :value="category.id">{{ category.name }}</option>
            </select>
        </div>
        <div class="form-group">
            <button type="button" @click="remove()"  class="btn btn-danger">DELETEE</button>
        </div>
    </div>
</template>

<script>
    export default {
        props: ['data'],
        data() {
            return {
                deletecategory: "",
                categories: this.data,
            }
        },
        methods: {
            remove() {
                alert();
            }
        },
    }
</script>

app.js

require('./bootstrap');

window.Vue = require('vue');

const files = require.context('./', true, /\.vue$/i);
files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key)));

const app = new Vue({
    el: '#app'
});

index.blade.php

<form action="{{-- route('categories.destroy', ['id' => $categories->id]) --}}" method="post">
    {{ method_field('DELETE') }}
    @csrf
    <deletecategory :data="{{ $categories }}"></deletecategory>
</form>

CategoryConttroller.php

public function destroy(Category $category)
{
    $category->delete();
    return redirect(route('categories.index'));
}

irankhosravi left a reply on Undefined Variable: Category

@MUNAZZIL - I get this error.

Too few arguments to function Illuminate\Support\Collection::get(), 0 passed in C:\xampp\htdocs\project\divar\app\Http\Controllers\Admin\CategoryController.php on line 18 and at least 1 expected

27 Nov
1 month ago

irankhosravi left a reply on Undefined Variable: Category

No, It looks like I am on the localhost:8000/cateogories/

irankhosravi started a new conversation Undefined Variable: Category

I use below link

https://laracasts.com/discuss/channels/laravel/how-to-save-category-in-laravel-57-with-vuejs

I'm working on a Laravel (v 5.7) project and i did the form to manage categories. Currently, i can create a new category and i would be able to delete.

I created the view (with blade) to delete the categories :

<form action="{{ route('categories.destroy', ['id' => $category->id]) }}" method="post">
    {{ method_field('delete') }}
    @csrf
    <div class="form-group">
        <label for="categories">Category:</label>
        <select name="{{ category->id }}">{{ category->name }}</select>
    </div>
    <div class="form-group">
        <button type="button" class="btn btn-danger">Delete</button>
    </div>
</form>

And in the routing file web.php, I wrote :

Route::group(['namespace' => 'Admin', 'prefix' => 'admin'],function (){
    $this->resource('categories', 'CategoryController');
});

Now I want to select a category from the list and delete it, How to work with vue.js

But I get this error

Undefined variable: category (View: C:\xampp\htdocs\project\divar\resources\views\Admin\categories\index.blade.php)

irankhosravi left a reply on How To Save Category In Laravel 5.7 With Vue.js

Thanks for answer.

Just another problem: it does not show up after the browser is refreshed.

I wrote that code in

<option v-for="category in categories" :value="category.id">@{{ category.name }}</option>

Is it correct?

irankhosravi left a reply on How To Save Category In Laravel 5.7 With Vue.js

I tried to save a category but failed. But you can help me.