oxbir

oxbir

Member Since 1 Month Ago

Experience Points
980
Total
Experience

4,020 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
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

Level 1
980 XP
Feb
19
1 week ago
Activity icon

Replied to Property [id] Does Not Exist On This Collection Instance.

This...

Property [id] does not exist on this collection instance. (View: C:\xampp\htdocs\sites\blog\resources\views\Home\galleries.blade.php)

Activity icon

Replied to Property [id] Does Not Exist On This Collection Instance.

I get this error again

Property [id] does not exist on this collection instance.

Activity icon

Replied to Property [id] Does Not Exist On This Collection Instance.

I created model of Gallery and Category already.

Activity icon

Replied to Property [id] Does Not Exist On This Collection Instance.

I get this error.

Call to undefined relationship [category] on model [App\Gallery].

Activity icon

Started a new Conversation Property [id] Does Not Exist On This Collection Instance.

Look at my codes and I have three tables,

  • galleries
  • categories
  • category_gallery

Gallery.php

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

GalleryController.php

public function gallery()
{
    $galleries = Gallery::whereNotNull('image')->latest()->paginate(25);
    $categories = Category::where('parent_id', 42)->with('galleries')->get();
    return view('Home.galleries', compact('galleries', 'categories'));
}

galleries.blade.php

 {{ dd($gallery->categories->id) }}

I get this error

Property [id] does not exist on this collection instance.

Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

Is there anyone who can answer my question?

Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

What should I do now? Help please.

Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

When I click a button.

Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

I changed last your post but It is not starting to use isotopes now ...

Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

Yes, But somewhere it shows a bad image ,

Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

Yes But somewhere it shows a bad image , I changed this

<script>
    $('.nav-item .nav-link').trigger('click');
    $('.nav-item .nav-link').on('click', function (e) {
        e.preventDefault();
        var id = $(this).attr('id');

        $(document).ready( function() {
            $('#pills-tabContent').isotope();
        });
    })
</script>
Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

I see show alert

    $('.nav-item .nav-link').on('click', function (e) {
        e.preventDefault();
        alert('hello');
Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

What should I do now? Help please.

Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

No, There is not any errors.

console

Feb
18
1 week ago
Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

Is there anyone who can answer my question?

Feb
17
1 week ago
Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

I tried show isotope for my site but I did not successfully.

ajax

<script src="https://unpkg.com/[email protected]/dist/isotope.pkgd.min.js"></script>
<script>
    $('.nav-item .nav-link').trigger('click');
    $('.nav-item .nav-link').on('click', function (e) {
        e.preventDefault();
        var id = $(this).attr('id');

        $('#pills-tabContent').isotope({ filter: '#'+id });
    })
</script>

And o updated mmy post

Feb
14
1 week ago
Activity icon

Started a new Conversation How To Create Protfolo With Isotope With Laravel

I have a categories table , I want to create like this site . http://onepage-d7.demo.weebpal.com/#panel-second-wrapper

public function gallery()
{
    $galleries = Gallery::whereNotNull('image')->latest()->paginate(25);
    $catCommittee = Category::where('parent_id',16)->get();
    $categories = Category::where('parent_id', 42)->get();
    return view('Home.galleries', compact('galleries','catCommittee', 'categories'));
}

galleries.blade.php

<div class="container">
    <h2 class="mt-3 mb-3">{{ __('message.menu.galleries') }}</h2>
    <div class="row">
        <div class="container-fluid" style="margin-top:20px;">
            <div class="row">
                <ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
                    @foreach($categories as $category)

                        <li class="nav-item">
                            <a class="nav-link"  id="isotope-{{ $category->id }}-tab" data-toggle="pill"                                         href="#isotope-{{ $category->id }}" role="tab" aria-controls="isotope-{{ $category->id }}" aria-selected="false">{{ $category->name }}</a>
                        </li>
                    @endforeach
                </ul>
            </div><hr noshade style="margin-top:-20px;">
            <div class="container grid">
                <div class="tab-content" id="pills-tabContent">

                    @foreach($categories as $key=>$category)
                        <?php $ok = false;?>
                        @foreach($category->galleries as $key=>$gallery)
                            <?php $ok = true;?>
                           @if(count($category->galleries) == 1 || $key == 0)

                            <div class="tab-pane fade" id="isotope-{{  $gallery->pivot->category_id }}" role="tabpanel" aria-labelledby="isotope-{{ $gallery->pivot->category_id }}-tab">
                        @endif
                                <div class="Portfolio">
                                    <a href="#!">
                                        <img class="card-img" src="{{ $gallery->image }}" alt="">
                                    </a>
                                    <div class="desc">{{ $gallery->title }}</div>
                                </div>
                                @if(count($category->galleries) == 1 || count($category->galleries) == ++$key)
                                    </div>
                                @endif
                        @endforeach
                        @if(!$ok)
                                <div class="tab-pane fade" id="isotope-{{  $category->id }}" role="tabpanel" aria-labelledby="isotope-{{ $category->id }}-tab"></div>
                        @endif
                    @endforeach
                </div>
            </div>
        </div>
    </div>
</div>
Jan
29
4 weeks ago
Activity icon

Replied to How To Open (modal) In SvgMap?

Hey, Why did not open modal when click in mobile

Activity icon

Replied to How To Open (modal) In SvgMap?

My site is http://oxbir.urmiahardware.ir/en , Please open it with mobile.

Jan
28
4 weeks ago
Activity icon

Started a new Conversation How To Open (modal) In SvgMap?

I installed https://github.com/StephanWagner/svgMap. And I added modal of bootstrap. My problem is when I work with laptop. it successfully. And when I click on the android of mobile, It did not show modal of bootstrap.

Jan
21
1 month ago
Activity icon

Replied to CSS3 Transform Rotate Not Working Like Psd

Answer my question

Jan
20
1 month ago
Activity icon

Started a new Conversation CSS3 Transform Rotate Not Working Like Psd

I have a psd like this.

rotate

I am trying to transform my items by rotating them 10 degrees.

footer .corner::before {
  background-color: #fda700;
  background-image: url(../images/pattern.png);
  width: 110%;
  height: 100%;
  position: absolute;
  content: "";
  top: 0;
  left: 0;
  right: 0;
  ;
}

footer .corner.left {
  left: 0;
}

footer .corner {
  top: 0;
  z-index: 2;
  overflow: hidden;
  position: absolute;
  width: 50%;
  height: 100px;
  padding-bottom: 10.5%;
}

footer .corner.right::before {
  -webkit-transform-origin: 100% 0;
  -ms-transform-origin: 100% 0;
  transform-origin: 100% 0;
  -webkit-transform: rotate(10deg);
  -ms-transform: rotate(10deg);
  transform: rotate(10deg);
}

footer .corner.left::before {
  -webkit-transform-origin: 0 100%;
  -ms-transform-origin: 0 100%;
  transform-origin: 0 100%;
  -webkit-transform: rotate(-11.8deg);
  -ms-transform: rotate(-11.8deg);
  transform: rotate(-11.8deg);
}
<footer>
  <div class="corner right"></div>
  <div class="corner left"></div>
</footer>

But I see this demo. I tried all the possible ways. But not working. Please fix this bug.

demo

Could anyone please suggest where I am going wrong?

Thanks.

Jan
18
1 month ago
Activity icon

Replied to How Can I Set The Default Value Laravel <select> Element?

I change this

  {{ dd($product->category_id) }}

it display null

Activity icon

Replied to How Can I Set The Default Value Laravel <select> Element?

Still selected the first option

Activity icon

Started a new Conversation How Can I Set The Default Value Laravel <select> Element?

I want to retrieve database values in category name and i want to show default value in selection. This is my controller for my edit view.

I have a category_product table.

category_product

<div class="col-md-4">
    <div class="form-group">
        <label for="category">category</label>
        <select class="form-control" name="category" id="category">
            @foreach($categories as $category)
                <option value="{{ $category->id }}" {{ $product->categories()->category_id == $category->id ? 'selected' : '' }}>{{ $category->name }}</option>
            @endforeach
        </select>
    </div>
</div>

ProductController.php

public function edit(Product $product)
{
    $categories = Category::all();
    return view('Admin.products.edit', compact('product', 'categories'));
}

Product.php

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

I get this error.

Undefined property: Illuminate\Database\Eloquent\Relations\BelongsToMany::$category_id

Activity icon

Replied to I Changed Update

I changed it but it did not save in database.

public function update(ProductRequest $request, Product $product)
{
    $data = [
        'title' => $request->title,
        'body' => $request->body,
        'user_id' => auth()->id(),
        'price' => $request->price
    ];

    if($request->has('image')) {
        $image = $request->file('image');
        $filename = $image->getClientOriginalName();
        $image->move(public_path('images/products'), $filename);
        $data['image'] = $request->file('image')->getClientOriginalName();
    }

    $product->save($data);
    $product->categories()->sync($request->category);

    return redirect()->route('products.index');
}
Activity icon

Replied to How Can I Set The Default Value?

@tray2 What is $book.

Activity icon

Started a new Conversation How Can I Set The Default Value?

I want to retrieve database values in category name and i want to show default value in selection. This is my controller for my edit view.

<div class="col-md-4">
    <div class="form-group">
        <label for="category">category</label>
        <select class="form-control" name="category" id="category">
            @foreach($categories as $category)
                <option value="{{ $category->id }}" {{$category->id == $category->id ? 'selected' : '' }}>{{ $category->name }}</option>
            @endforeach
        </select>
    </div>
</div>

ProductController.php

public function edit(Product $product)
{
    $categories = Category::all();
    return view('Admin.products.edit', compact('product', 'categories'));
}
Jan
17
1 month ago
Activity icon

Started a new Conversation How To Attach My Categories

I defined change my codes with a word of 'create'.

public function store(Request $request)
{
    if($request->has('image')) {
        $image = $request->file('image');
        $filename = $image->getClientOriginalName();
        $image->move(public_path('images/products'), $filename);
        $productImage = $request->file('image')->getClientOriginalName();
    }
    $request->attach($request->categories);
    Product::create([
        'title' => $request->title,
        'body' => $request->body,
        'user_id' => auth()->user()->id,
        'price' => $request->price,
        'image' => $productImage,
    ]);
}
Jan
14
1 month ago
Activity icon

Started a new Conversation I Changed Update

Is this code correct for updating?

public function update(Request $request, Product $product)
{
    if($request->has('image')) {
        $image = $request->file('image');
        $filename = $image->getClientOriginalName();
        $image->move(public_path('images/products'), $filename);
        $productImage = $request->file('image')->getClientOriginalName();
    }
    Product::save([
        'title' => $request->title,
        'body' => $request->body,
        'user_id' => auth()->id(),
        'price' => $request->price,
        'image' => $productImage,
    ]);
}
Activity icon

Replied to 404 Not Found

My routes look like.

Route::namespace('Admin')->middleware(['auth:web', 'CheckAdmin'])->prefix('admin')->group(function () {
    Route::get('dashboard', '[email protected]')->name('dashboard.index');
    Route::resource('categories', 'CategoryController');
    Route::resource('products', 'ProductController');
});

server.php

if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
    return false;
}

require_once __DIR__.'/index.php';
Activity icon

Replied to 404 Not Found

@jove

I cleared my route & cache & config.

But my problem did not solve.

Activity icon

Started a new Conversation 404 Not Found

When I click on edit I see this message

404 | Not Found.

Look at my codes.

index.blade.php

<a href="{{ route('categories.edit', $category->id) }}"  class="btn btn-primary">Edit</a>

web.php

Route::resource('categories', 'CategoryController');

CategoryController.php

public function edit(Category $category)
{
    $allCategory = Category::all();
    return view('Admin.categories.edit', compact('allCategory', 'category'));
}

Is there a problem?

Jan
13
1 month ago
Activity icon

Replied to SQLSTATE[42000]: Syntax Error Or Access Violation

I get this error.

Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that cor responds to your MariaDB server version for the right syntax to use near 'unsigned not null, telephone varchar(191) not null, email varchar(191) not n' at l ine 1 (SQL: create table users (id bigint unsigned not null auto_increment primary key, first_name varchar(191) not null, last_name varchar(191) not nul l, mobile varchar(191) unsigned not null, telephone varchar(191) not null, email varchar(191) not null, email_verified_at timestamp null, password var char(191) not null, image varchar(191) null, remember_token varchar(100) null, created_at timestamp null, updated_at timestamp null) default character s et utf8mb4 collate 'utf8mb4_unicode_ci')

Activity icon

Started a new Conversation SQLSTATE[42000]: Syntax Error Or Access Violation

I am using XAMPP and MySQL version. I'm trying to migrate Laravel media libraries package:

DATABASE

public function up()
{
    Schema::create('users', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->string('first_name');
        $table->string('last_name');
        $table->string('mobile')->unsigned();
        $table->string('telephone');
        $table->string('email')->unique();
        $table->timestamp('email_verified_at')->nullable();
        $table->string('password');
        $table->string('image')->nullable();
        $table->rememberToken();
        $table->timestamps();
    });
}
Jan
06
1 month ago
Activity icon

Replied to GetRouteKeyName Is Not Working

I changed it but I did not solve my problem yet.

Activity icon

Replied to GetRouteKeyName Is Not Working

products table

public function up()
{
    Schema::create('products', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->bigInteger('user_id')->unsigned();
        $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
        $table->string('lang');
        $table->string('title');
        $table->string('image');
        $table->string('price');
        $table->string('slug');
        $table->text('body');
        $table->timestamps();
    });

    Schema::create('category_product', function (Blueprint $table) {
        $table->bigInteger('category_id')->unsigned();
        $table->bigInteger('product_id')->unsigned();
        $table->primary(['category_id', 'product_id']);
        $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
        $table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
    });
}
Jan
05
1 month ago
Activity icon

Replied to GetRouteKeyName Is Not Working

I tried change it. but my problem did not solve yet/ ir display null

Activity icon

Replied to GetRouteKeyName Is Not Working

@kevdev I got error in this line {{ dd($item[$i]->name) }}

Activity icon

Started a new Conversation GetRouteKeyName Is Not Working

Look at my codes.

Table of categories.

Category.php

use Sluggable;

public function products()
{
    return $this->belongsToMany(Product::class);
}

public function getRouteKeyName()
{
    return 'name';
}

public function sluggable()
{
    return [
        'slug' => [
            'source' => 'name'
        ]
    ];
}

I get this error.

Trying to get property of non-object

Jan
03
1 month ago
Activity icon

Replied to How To Show Categories

categories table

public function up()
{
    Schema::create('categories', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->string('name');
        $table->text('description');
        $table->bigInteger('parent_id')->default(0);
        $table->string('lang');
        $table->bigInteger('user_id')->unsigned();
        $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
        $table->timestamps();
    });
}
Activity icon

Started a new Conversation How To Show Categories

Look at my codes.

products table

public function up()
{
    Schema::create('products', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->bigInteger('user_id')->unsigned();
        $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
        $table->string('lang');
        $table->string('title');
        $table->string('image');
        $table->string('price');
        $table->string('slug');
        $table->text('body');
        $table->timestamps();
    });

    Schema::create('category_product', function (Blueprint $table) {
        $table->bigInteger('category_id')->unsigned();
        $table->bigInteger('product_id')->unsigned();
        $table->primary(['category_id', 'product_id']);
        $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
        $table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
    });
}

Product.php

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

ProductController.php

public function show(Product $product)
{
    
    return view('Home.contents.product', compact('product'));
}

index.blade.php

<span>{{ dd($product->categories->name) }}</span>

I get this error

Property [name] does not exist on this collection instance.

Jan
01
1 month ago
Activity icon

Replied to HOW TO Create And Publish A Laravel Package On Packagist

I asked yesterday. but I received no response from him

Activity icon

Replied to HOW TO Create And Publish A Laravel Package On Packagist

I beg you to return my questions

Activity icon

Started a new Conversation HOW TO Create And Publish A Laravel Package On Packagist

i have created laravel package,and have one view test.blade.php showing basic form ,but inside that form when ,try to use route('contact') ,it shows me an error message.

Route [contact] not defined.

my route file web.php in package folder

<?php
// matrixhive\testpackage\src\routes\web.php
Route::get('contact', function(){
    return view('testpackage::test');
});

Route::post('contact', function(){
    echo "thanks for submission of form";
});

?>

my view file in side package

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<title>Contact Us</title>
</head>
<body>

<div style="width: 500px; margin: 0 auto; margin-top: 90px;">
@if(session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div>
@endif

<h3>Contact Us</h3>

<form action="{{route('contact')}}" method="POST">
@csrf
<div class="form-group">
<label for="exampleFormControlInput1">Your name</label>
<input type="text" class="form-control" name="name" id="exampleFormControlInput" placeholder="John Doe">
</div>
<div class="form-group">
<label for="exampleFormControlInput1">Email address</label>
<input type="email" class="form-control" name="email" id="exampleFormControlInput1" placeholder="[email protected]">
</div>

<div class="form-group">
<label for="exampleFormControlTextarea1">Enter Your Message</label>
<textarea class="form-control"name="message" id="exampleFormControlTextarea1" rows="3"></textarea>
</div>

<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</body>
</html>

i am learning laravel package development from here