irankhosravi

irankhosravi

Member Since 1 Year Ago

Experience Points 9,360
Experience Level 2

640 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 1
Lessons
Completed
Best Reply Awards 0
Best Reply
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.

07 Mar
1 week ago

irankhosravi left a reply on ReferenceError: $ Is Not Defined

@STEREOH - Thanks for answer

Only this is not working.

I want show li info

    <li class="list-group-item">
        <a class="text-danger d-block" href="#">
            <i class="fas fa-users"></i>
            <span>Users</span>
            <i class="fas fa-angle-left float-left"></i>
            <div class="d-none">
                <a class="w-100 d-block" href="#">Users List</a>
                <a class="w-100 d-block" href="#">Add a new user</a>
            </div>
        </a>
    </li>
$("li").click(function () { $(".d-none").show(); });

irankhosravi left a reply on ReferenceError: $ Is Not Defined

My Javascript code included before jQuery loading

Error

irankhosravi started a new conversation ReferenceError: $ Is Not Defined

I have this error message ReferenceError: $ is not defined

This is my header.

<!doctype html>
<html lang="fa" dir="rtl">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="{{ asset('themes/css/bootstrap.min.css') }}">
    <link rel="stylesheet" href="{{ asset('themes/css/bootstrap-rtl.min.css') }}">
    <link rel="stylesheet" href="{{ asset('themes/css/all.min.css') }}">
    <link rel="stylesheet" href="{{ asset('themes/css/style.css') }}">

    <title>Admin</title>
</head>
<body>
@include('Admin.layouts.header')
<div id="app">
    <div class="row">
        @include('Admin.layouts.sidebar')
        @yield('content')
    </div>
</div>
@include('Admin.layouts.footer')
<script src="{{ asset('themes/js/jquery-3.3.1.slim.min.js') }}"></script>
<script src="{{ asset('themes/js/popper.min.js') }}"></script>
<script src="{{ asset('themes/js/bootstrap.min.js') }}"></script>
<script src="{{ asset('themes/js/jquery-3.3.1.min.js') }}"></script>
</body>
</html>

Following is my JavaScript code

<footer>

</footer>

<script>
    $("#list").click(function () {
        $("#submenu").show();
    });
</script>
21 Feb
3 weeks ago

irankhosravi left a reply on Laravel Collective

I installed Laravel 5.7 and I want to install Laravel Collective 5.4.

In your opinion I install?

irankhosravi started a new conversation Laravel Collective

Can Laravel Collective 5.4 be done with Laravel 5.7?

04 Feb
1 month ago

irankhosravi left a reply on How To Display Own Category In Own Block With Laravel?

Yes I have any other options for career choice... In database I have data in my database.

irankhosravi left a reply on How To Display Own Category In Own Block With Laravel?

What do you mean? In which file? Controller Or Model Or Database ....

irankhosravi left a reply on How To Display Own Category In Own Block With Laravel?

I tried already about and abouts. I get this error.

Property [abouts] does not exist on this collection instance. (View: C:\xampp\htdocs\img\test\resources\views\Home\index.blade.php)

Property [about] does not exist on this collection instance. (View: C:\xampp\htdocs\img\test\resources\views\Home\index.blade.php)

irankhosravi left a reply on How To Display Own Category In Own Block With Laravel?

Does anyone answer my questions?

irankhosravi left a reply on How To Display Own Category In Own Block With Laravel?

@SNAPEY - I followed your post but my problem did not solve yet.

Eroor

03 Feb
1 month ago

irankhosravi started a new conversation How To Display Own Category In Own Block With Laravel?

We have three blocks

Block

And three categories:

  • Important Links
  • Userful Links
  • Get in touch

I want to display Userful Links in block when select and save Userful Links category.

I want to display categories where categoory_id = id

Controller

public function index ()
{
    $id = 1;
    $webDesigns = About::with(['categories' => function($q) use ($id) {
        $q->where('category_id', $id);
    }])->get();
    return $webDesigns;
    $webDesigns = About::with(['categories' => function($q) { $q->where('id', 1); }])->get();
    $developers = About::with(['categories' => function($q) { $q->where('id', 2); }])->get();
    $graphics = About::with(['categories' => function($q) { $q->where('id', 3); }])->get();
    $computers = About::with(['categories' => function($q) { $q->where('id', 4); }])->get();
    return view('Home.index', compact('webDesigns', 'developers', 'graphics', 'computers'));
}

Model

public function categories()
{
    return $this->belongsToMany(Category::class);
}

Table(s)

Schema::create('about_category', function (Blueprint $table) {
    $table->integer('about_id')->unsigned();
    $table->integer('category_id')->unsigned();

    $table->foreign('about_id')->references('id')->on('abouts')->onDelete('cascade');
    $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
});

Schema::create('categories', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->timestamps();
});

Schema::create('abouts', function (Blueprint $table) {
    $table->increments('id');
    $table->string('title');
    $table->text('body');
    $table->timestamps();
});

How to this work? OR What am I missing?

irankhosravi left a reply on How To Show Display Categoory_id = Id

We have three blocks

Block

And three categories:

  • Important Links
  • Userful Links
  • Get in touch

I want to display Userful Links in block when select and save Userful Links category.

irankhosravi left a reply on How To Show Display Categoory_id = Id

I want to display all categories = 1

irankhosravi started a new conversation How To Show Display Categoory_id = Id

I want to display categories where categoory_id = id

Controller

public function index ()
{
    $abouts = About::all();
    $webDesigns = $abouts->categories()->where('id', '1');
    return view('Home.index', compact('webDesigns'));
}

Model

public function categories()
{
    return $this->belongsToMany(Category::class);
}

Table(s)

Schema::create('about_category', function (Blueprint $table) {
    $table->integer('about_id')->unsigned();
    $table->integer('category_id')->unsigned();

    $table->foreign('about_id')->references('id')->on('abouts')->onDelete('cascade');
    $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
});

Schema::create('categories', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->timestamps();
});

Schema::create('abouts', function (Blueprint $table) {
    $table->increments('id');
    $table->string('title');
    $table->text('body');
    $table->timestamps();
});

How to this work? OR What am I missing?

irankhosravi left a reply on How To Display Category Where Id = 1?

@SERGIU17 - Can you send complete sample code.

irankhosravi left a reply on How To Display Category Where Id = 1?

@VILFAGO - I see this red line color in ide phpstorm

error

irankhosravi started a new conversation How To Display Category Where Id = 1?

I want to display categories where id = 1

Controller

public function index ()
{
    $abouts = About::all();
    $webDesigns = $abouts->categories()->where('id', '1');
    return view('Home.index', compact('webDesigns'));
}

Model

public function categories()
{
    return $this->belongsToMany(Category::class);
}

Table(s)

Schema::create('about_category', function (Blueprint $table) {
    $table->integer('about_id')->unsigned();
    $table->integer('category_id')->unsigned();

    $table->foreign('about_id')->references('id')->on('abouts')->onDelete('cascade');
    $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
});

Schema::create('categories', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->timestamps();
});

Schema::create('abouts', function (Blueprint $table) {
    $table->increments('id');
    $table->string('title');
    $table->text('body');
    $table->timestamps();
});

But I get this error

Method Illuminate\Database\Eloquent\Collection::categories does not exist.

How to this work? OR What am I missing?

irankhosravi left a reply on Method Illuminate\Database\Eloquent\Collection::categories Does Not Exist.

I followed on top posts and I get this error

BadMethodCallException Method Illuminate\Database\Eloquent\Collection::categories does not exist.

my problem did not solve

02 Feb
1 month ago

irankhosravi started a new conversation Method Illuminate\Database\Eloquent\Collection::categories Does Not Exist.

How to this work?

class HomeController extends Controller
{
    public function index ()
    {
        $abouts = About::all();
        $webDesigns = $abouts->categories()->where(id, 1);
        return view('Home.index', compact('webDesigns'));
    }
}

irankhosravi started a new conversation Laravel 5.7 Error Message “ Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No Message”

When I update a form about I get this error.

Symfony \ Component \ HttpKernel \ Exception MethodNotAllowedHttpException No message

web.php

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

AboutController.php

public function edit(About $about)
{
    $categories = Category::all()->pluck('name' , 'id');
    return view('Admin.abouts.edit', compact('about', 'categories'));
}


public function update(Request $request, About $about)
{
    $about->categories()->sync(request('category'));
}

edit.blade.php

<form action="{{ route('abouts.edit', ['id' => $about->id]) }}" method="post">
    {{ csrf_field() }}
    {{ method_field('PATCH') }}
    <div class="form-group">
        <label for="title">Title</label>
        <input type="text" class="form-control" value="{{ $about->title }}" name="title" id="title">
    </div>
    <div class="form-group">
        <label for="category">category</label>
        <select name="category[]" class="form-control" id="category"  multiple>
            @foreach( $categories as $id => $name )
                <option value="{{ $id }}" {{ in_array($id , $about->categories()->pluck('id')->toArray()) ? 'selected' : '' }}>{{ $name }}</option>
            @endforeach
        </select>
    </div>
    <div class="form-group">
        <label for="body">Body</label>
        <textarea class="form-control" rows="6" name="body" id="body">{{ $about->body }}</textarea>
    </div>
    <input type="submit" class="btn btn-success" value="Save">
</form>

Model for about

protected $table = 'abouts';

protected $fillable = [
    'title', 'body'
];

public function categories()
{
    return $this->belongsToMany(Category::class);
}

Mode for categories

protected $table = 'categories';

protected $fillable = [
    'name'
];

irankhosravi left a reply on Base Table Or View Not Found: 1146 Table Laravel 5.7

How to Share the migration for the pivot table?

irankhosravi left a reply on Base Table Or View Not Found: 1146 Table Laravel 5.7

For abouts table

public function up()
{
    Schema::create('abouts', function (Blueprint $table) {
        $table->increments('id');
        $table->string('title');
        $table->text('body');
        $table->timestamps();
    });
}

For categories table

public function up()
{
    Schema::create('categories', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
        $table->timestamps();
    });
}

irankhosravi started a new conversation Base Table Or View Not Found: 1146 Table Laravel 5.7

Im getting this error when I try to save data to mysql using Laravel 5, other forms and save() methods work fine but this one:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'datatest.about_category' doesn't exist (SQL: insert into about_category (about_id, category_id) values (11, 4))

Here is my Controller store method:

public function store(AboutRequest $request)
{
    $about = new About();
    $about->title = $request->title;
    $about->body = $request->body;
    $about->save();
    $about->categories()->attach(request('category'));
    return redirect(route('abouts.create'));
}

And here is my model:

About.php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class About extends Model
{
    public  $table = "abouts";
    public function categories()
    {
        return $this->belongsToMany(Category::class);
    }
}

Category .php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Category extends Model
{
    protected $table = "categories";

    public  $fillable = ['id' , 'name'];

    public function abouts(){
        return $this->belongsToMany(About::class);
    }
}
30 Jan
1 month ago

irankhosravi started a new conversation How To Design Sample Psd Logo On Menu With Bootstrap 4

I have a psd for web design.

heeader

I tryed put the logo on the navabr menu. But I see this demo.

Demo

Here is my codes of HTML.

<section id="header" class="container pt-5">
<img src="logo.png" class="logo float-right">
<div class="float-left col-md-3">
    <img src="images\allah.png" class="mb-3">
    <form class="input-group">
        <input type="text" class="form-control" placeholder="جستجو">
        <div class="input-group-prepend">
            <span class="input-group-text">
                <i class="fas fa-search"></i>
            </span>
        </div>
    </form>
</div>
<nav class="navbar navbar-expand-lg navbar-light bg-blue float-right w-100">
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarNavDropdown">
        <ul class="navbar-nav">
            <li class="nav-item active">
                <a class="nav-link" href="#">صفحه اصلی</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">درباره ما</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">محصولات</a>
            </li>
        </ul>
    </div>
</nav>
</section>

What am I missing?

28 Jan
1 month ago

irankhosravi started a new conversation How To Design Sample Psd With Bootstrap 4

I want to design the same psd.

[![psd][1]][1]

<div class="col-md-6 align-self-center" style="font-size: 70%">
    <div class="card-body">
        <div class="d-inline-flex align-items-center">
            <div class="row">
                <h4 class="col-sm-1 ml-3"><i class="fas fa-map-marker-alt"></i></h4>
                <p class="col-sm-11">Address
                    <br>1600 Pennsylvania Ave NW, Washington, DC 20500
                </p>
            </div>
            <div class="row">
                <h4 class="col-sm-1 ml-3"><i class="fas fa-phone"></i></h4>
                <p class="col-sm-11">Telephone
                    <br>8888888888
                </p>
            </div>
            <div class="row">
                <h4 class="col-sm-1 ml-3"><i class="fas fa-envelope"></i></h4>
                <p class="col-sm-11">Email
                    <br>[email protected]
                </p>
            </div>
            <div class="row">
                <div class="mr-5 h4">
                    <div class="d-inline">
                        <i class="fab fa-bluetooth-b"></i>
                        <i class="fab fa-instagram"></i>
                        <i class="fab fa-facebook"></i>
                        <i class="fab fa-google-plus"></i>
                        <i class="fab fa-twitter"></i>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

But I see this demo.

[![Demo][2]][2]

The justify-content-center aligns the form horizontally, but I can't figure out how to align it vertically. I have tried to use align-items-center and align-self-center, but it doesn't work.

What am I missing? [1]: https://i.stack.imgur.com/A7cna.jpg [2]: https://i.stack.imgur.com/1URBI.jpg

23 Jan
1 month ago

irankhosravi left a reply on How To Show Data In Database In Vue Devtools?

I tried in ten hours , But my problem did not solve yet.

22 Jan
1 month ago

irankhosravi left a reply on How To Show Data In Database In Vue Devtools?

When I refresh page I see this message in Console. is this a problem?

Console

irankhosravi left a reply on How To Get Json With Laravel

Can you tell me from zero. How to display in the blade . I'm the first time to get acquainted with api. Thank you very much.

irankhosravi started a new conversation How To Get Json With Laravel

I have a project with laravel 5.7

JSON

Tables of yours with the fields. Only you write communications and you leave me out. Of course, json will give you the sample as well, only you will be delivered to me For example, two types of the Vergoolar classical machine are stored with the data given in the data base and displayed in the output as json, according to the example I give you.

irankhosravi left a reply on How To Show Data In Database In Vue Devtools?

When I refresh page I see this message in Console. is this a problem?

Console

irankhosravi left a reply on How To Show Data In Database In Vue Devtools?

@CRONIX - Hi , I want to only when I click on Cars for example, show info in devtools Vue.

How should I do?

irankhosravi left a reply on How To Show Data In Database In Vue Devtools?

Is there anyone answering my questions?

irankhosravi left a reply on How To Show Data In Database In Vue Devtools?

Is there anyone answering my questions?

20 Jan
1 month ago