Our Black Friday sale is now live! All individual subscriptions are 50% OFF. This week only!

Norbertho

Norbertho

Member Since 2 Years Ago

Experience Points
24,220
Total
Experience

780 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
171
Lessons
Completed
Best Reply Awards
5
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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 5
24,220 XP
Nov
20
4 days ago
Activity icon

Replied to Livewire Get The Auth::user()->id

Sorry it was my bad i have forget to add user_id to the fillabel array in the model

Activity icon

Replied to Livewire Get The Auth::user()->id

yes 100% sure that user logged in and i haveing the following errror: "SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a default value" So it seamlike 'user_id' => Auth::user()->id,not working

Activity icon

Replied to Livewire Get The Auth::user()->id

Then there must be somethog wrong with mycode:

<?php

namespace App\Http\Livewire;

use App\Models\User;
use App\Models\menhely;
use Livewire\Component;
use Livewire\WithFileUploads;
use Auth;

class MenhelyProfile extends Component
{
    use WithFileUploads;
    public $name;
    public $tel;
    public $email;
    public $webcim;
    public $irsz;


    public function register()
    {
        $menhely = menhely::create([
        'user_id' => Auth::user()->id,
        'name' => $this->name,
        'tel' => $this->tel,
        'email' => $this->email,
        'webcim' => $this->webcim,
        'irsz' => $this->irsz,

    ]);
    }

    public function render()
    {
        return view('livewire.menhely-profile');
    }
}

Activity icon

Started a new Conversation Livewire Get The Auth::user()->id

When I create a post in livewire how can i get the authenticated user id like Auth::user()->id so I can save it into the post model user_id field?

Nov
04
2 weeks ago
Activity icon

Replied to How To Use Livewire With Laravel Fortify For Registration?

Hi @sshateri ! What I was ended up is the conclusion that fortiy is handeling the authentication so there is nothiong special how fortify register users so I created a Livewire register component: "php artisan make:livewire Register" and then I save the user inside my app/Http/Livewire/Register.php with the following code:

<?php

namespace App\Http\Livewire\Auth;

use App\Models\User;
use Livewire\Component;
use Illuminate\Support\Facades\Hash;

class Register extends Component
{
    public $email = '';
    public $password = '';
    public $passwordConfirmation = '';

    protected $rules = [
        'email' => 'required|email|unique:users',
        'password' => 'required|min:6|same:passwordConfirmation',
    ];

    public function updatedEmail()
    {
        $this->validate(['email' => 'unique:users']);
    }

    public function register()
    {
        $this->validate();

        $user = User::create([
            'email' => $this->email,
            'password' => Hash::make($this->password),
        ]);

        auth()->login($user);

        return redirect('dashboard');
    }

    public function render()
    {
        return view('livewire.register')
            ->layout('layouts');
    }
}

And it willcreate exatly the same users that fortify would save. So there is no difference between the two users saved with livewire an fortify. for user update and for user authentication i use fortify "out of the box" code.

I hope it helped to you.

Oct
31
3 weeks ago
Activity icon

Replied to How To Submit The Registration Form Using Livewire To Fortify?

Ohh yes I have checked. And the problem is with livewire you submit the form to a method but for fortify I have to submit the form to the register route

Activity icon

Started a new Conversation How To Submit The Registration Form Using Livewire To Fortify?

Is there any way to submit a livewire registration form to Laravel Fortify?

Oct
30
3 weeks ago
Activity icon

Replied to How To Use Livewire With Laravel Fortify For Registration?

I wanted to do it with livewire because i have a select option ( using alpine.js ) on the registration page and based on the user selection i show different registration form for the users, but if the user submit the form and there is any validation error then the page reloads and user is dropped back to the select option and of course they cant see the validation error as the paged reloded and the selected option has ben reseted so the registration form is hidden again. With livewire i could prevent the page reload so the user would see the validation errors.

But as i digging deeper into this topic it is clearly it is out of my knowlade i wont be able to merge livewire and "the out of the box fortify registration view and controller" so probably i just register the user without fortify using livewire component.

Activity icon

Replied to Vue Js - Add Selection Dynamically To Form.

so you can push a new row into dropdown but you cant delete it?

Activity icon

Replied to How To Use Livewire With Laravel Fortify For Registration?

Thanks for that, to creating a new post or contact form using livewire is no problem. My problem comes when i would like to use the livewire real time validationon the laravael jetstream "out of the box " registration form because in this case there is no app/http/livewire/Register.php where i could write my validation there is only app/actions/fortify/CreateNewUser.php but the wire:model="email" wire:model="password" wire:model="password_confirmation" wont "communicate" with this file

Activity icon

Replied to How To Use Livewire With Laravel Fortify For Registration?

OK so let's say I would like to add livewire validation to the register form. I use on the form tag and i add the wire:model="email" wire:model="password" wire:model="password_confirmation"

so if i hit the register button and get the validation errors without refresh the registration page.

Activity icon

Replied to How To Use Livewire With Laravel Fortify For Registration?

Ok it will be probobly the a stupid question, but I still ask it becase the picture is not clear for me at the moment.

Lets say I install a new laravle project with Jetstream and livewire. In ths case I will have a working user registration out of the box with user dashboard. And let's say i create my ownuser registration form as well by using the following command: "php artisan make:livewire Wireuserreg" it will creat form me 2 files 1 inside the views/livewire/Wireuserreg.blade.php and the other one is inside App/http/livewire/Wireuserreg.php If I save the user with my App/http/livewire/Wireuserreg.php withthe following:

    public function register()
    {
        $this->validate();

        $user = User::create([
            'email' => $this->email,
            'password' => Hash::make($this->password),
        ]);

        auth()->login($user);

        return redirect('/');
    }

will be there any difference between users saved with livewire and users saved with the out of the box fortify ?

Activity icon

Replied to How To Use Livewire With Laravel Fortify For Registration?

I know that is how i installed but the registration is using simple blade without livewire and the data is passed to the fortify controller not to livewire "controller"

Activity icon

Started a new Conversation How To Use Livewire With Laravel Fortify For Registration?

I have fresh Laravel installation with Jetstream using Livewire. My question is how can i implement livewire into the registration? The out of the boxlaravel using fortify for registration and iwould like to keep the fortify par I just would like to implement livewire for better validation during the registration.

Oct
16
1 month ago
Activity icon

Replied to Vimeo Api Using Laravel Best Package

Hi Have you been able to achieve it?

Oct
06
1 month ago
Activity icon

Replied to Any Tutorial Recommendation About This X-jet Markup?

@automica Do you think blade components and slots are better then includes and section and yield ?

Activity icon

Started a new Conversation Any Tutorial Recommendation About This X-jet Markup?

Is there any tutorial about this new jetstream markups? for example x-jet-application-logo, x-jet-welcome and so on.

Oct
05
1 month ago
Activity icon

Replied to Try To Use Laravel 8 And Livewire

Aha ok! An in-depth laracast series about laravel 8 and jetstream would priceless for me :)

Activity icon

Replied to Try To Use Laravel 8 And Livewire

@snapey so

<x-jet-welcome /> 

is not livewire it is a Laravel component?

Activity icon

Replied to Try To Use Laravel 8 And Livewire

Thnaks for your answers guys. I think I going back to fortify and vue.js instead of Jetstream. I dont want to and I dont have time to learn this livewire think. I have published the livewire files and it published 25 blade files form me and i dont even started my project :) ... no thanks.

Activity icon

Started a new Conversation Try To Use Laravel 8 And Livewire

This code is in laravel 8 layouts/app.blade.php where is the content coming from? what is {{ $header}} and what is {{ $slot}} ? I want my own contetn there

           <!-- Page Heading -->
            <header class="bg-white shadow">
                <div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
                    {{ $header }}
                </div>
            </header>

            <!-- Page Content -->
            <main>
                {{ $slot }}
            </main>
        </div>

Aug
11
3 months ago
Activity icon

Replied to Laravel Got Stuck After Login. Laravel 5.8

@jlrdw yeah I saw that github issue page you just linked in. So as you can see I am not the only person who has this issue.. I understand that you dont experienced this problem before, but I havent changed my setup for a while and I disabled all my chrome extensions to track the issue. still now solution. Only think i can think of is that probably you are using a Mac and I am using a Win machine and maybe there are some differences, probably i will reinstall my whole system and see if it is solve this issue.

Activity icon

Replied to Laravel Got Stuck After Login. Laravel 5.8

@mboynes Hi, thanks for your answer. I dont use any extensions so in this case this could not be the problem . Problem must be somewhere else :/

Aug
09
3 months ago
Activity icon

Replied to Laravel Got Stuck After Login. Laravel 5.8

i did not modify anything. this is happening with out of the box authentication..

Activity icon

Replied to Laravel Got Stuck After Login. Laravel 5.8

I have just created a fresh Laravel app.. Ihave experience this issue every time when i open chrome in this video you will see the issue: https://youtu.be/eRwIC3r7j7I

Activity icon

Replied to Laravel Got Stuck After Login. Laravel 5.8

I have the same issue with a freshly installed Laravel app.. However i think it is somehow Chrome related because I dont experience this problem in Firefox.

Activity icon

Replied to Store Users Selected Language Option

@aurawindsurfing I know it is a feature and not a bug. I dont complain about it my question is is there any way to keep only that variable in the session ? If i save it in cookie would be the same result? Or is there a way to modify the logout function that just before it do the return redirect to the welcome page i set the language variable in the session?

Activity icon

Started a new Conversation Store Users Selected Language Option

Hi, I am creating an app.and currently I store the user selected language option in session and it works perfectly for example if user selects English language then I store the 'en' in session with the following controller:

    public function index($locale){
        App::setlocale($locale);
        session()->put('locale', $locale);
        return redirect()->back();
    }

and I do the following in a middleware:

public function handle($request, Closure $next) {
        if (session()->has('locale')) {
            App::setlocale(session()->get('locale'));
        }else{
            App::setlocale('hu');
            session()->put('locale', 'hu');
        }
        return $next($request);
    }

It works fine user can navigate trough the app back and forward and the selected language is stay as users selected. I can log in into app and the selected language option is stay as selected and stored in session. However when the user logout from the app and redirected to the welcome page then the session is reset and the selected language cleared and the default language is set. Is there any way to prevent the logout function to clear the selected language optino?

Jul
31
3 months ago
Activity icon

Replied to Vue SPA With Laravel Authentication

Thanks @jeffreyvanrossum and @doncho85 for your replies. So basically it is adviced to install vue and laravel separately, but if i want i can develop them in the same project folder too. The main point here i need to use laravel api route as a connection between vue and laravel.

Jul
30
3 months ago
Activity icon

Replied to How To Get Products Where Category Id

@michaloravec like this? it is not woking

$products = Product::whereHas('categories', function ($query) use ($id){
                $query->where('categories.id', $id);
            })
            ->with(['productimages' => function($q){
             $q->where('productimages.featured', '=', '1')->select(['id', 'image']);
            }, 'categories'])->orderBy('id', 'DESC')
            ->paginate(9);
Activity icon

Replied to How To Get Products Where Category Id

Thanks @michaloravec Yeah that was my bad a wrote it incorrectly in my question but of course i used belongsToMany on both models in my projects. However now as you can see i load productimges as well but i would like to load only the image with featured field is 1. and select only the image column. It works

$products = Product::whereHas('categories', function ($query) use ($id){
                $query->where('categories.id', $id);
            })
            ->with(['productimages' => function($q){
             $q->where('productimages.featured', '=', '1');
            }, 'categories'])->orderBy('id', 'DESC')
            ->paginate(9);

but when i try to select only the image column then it is not working

$products = Product::whereHas('categories', function ($query) use ($id){
                $query->where('categories.id', $id);
            })
            ->with(['productimages' => function($q){
             $q->where('productimages.featured', '=', '1')->select('image);
            }, 'categories'])->orderBy('id', 'DESC')
            ->paginate(9);
Activity icon

Replied to How To Get Products Where Category Id

i have found the solution:

    public function fetchproducts($catid){
        $products = Product::whereHas('categories', function ($query) use ($catid){
            $query->where('categories.id', $catid);
        })
        ->with(['productimages', 'categories'])->orderBy('id', 'DESC')
        ->paginate(9);

    
        return $products;
    }
Activity icon

Started a new Conversation How To Get Products Where Category Id

Hi, I have a products and categories and category_product tables. So i have hasMany and belongsToMany relationship between the Products and Categories. When the user clicks on the category then i send an axios request to the controller and I would like to return the products related to that category. I have something like this in my controller but I cant make it work:

    public function fetchproducts($catid){
        $products = Product::where('categories', function ($query) use ($catid){
            $query->where('id', $catid);
        })
        ->with('productimages')->orderBy('id', 'DESC')
        ->paginate(9);


        return $products;
    }
Jul
29
3 months ago
Activity icon

Started a new Conversation Vue SPA With Laravel Authentication

Hi, I am in a learning phase in learning Vue js SPA with Laravel. I watching tutorials on YouTube and all the tutorials shows that they create a new Laravel project then the create a new Vue js project with Vue CLI. But I am a bit confused why they so that? Laravel comes with vue js if I run "composer require laravel/ui" and then "php artisan ui vue" so why the they do it separately? Is it not working if I install vue with laravel?

Jul
15
4 months ago
Activity icon

Commented on Refactoring Views: Part 2

Will you publish a video about the animated rating circle as well?

Activity icon

Started a new Conversation Video About How Laracast Handling Videos

Hi, I saw your video about video.js but as I can see now you are using vimeo for hosting videos on Laracast. A tutorial about how you upload and then display videos on Laracast website would be useful. Are you using the Vimeo API to upload videos or you are uploading the videos straight on Vimeo website?

Jun
25
4 months ago
Activity icon

Replied to Can't Save Boolean Into Mysql With Laravel

Thnaks @frankielee now I just convert it in my vue js compontent to 1 or 0 and i send it that way to the controller and it works. I thought I can update the $request->completed in the controller and then use update($request->all()); You were right it not working that way. Now in my vue js componetn my code looks like this and it works.

        toggleTodo(e){
             e.completed = !e.completed
            let data = new FormData();
            data.append('_method', 'PATCH');
            if(e.completed == true){
                 data.append('completed', 1);
             }
            if(e.completed == false){
                 data.append('completed', 0);
             }
            axios.post('/api/todo/'+e.id, data).then((res) =>{
               
            }).catch((error) => {
                this.form.errors.record(error.response.data.errors)
            })
        },

Activity icon

Replied to Can't Save Boolean Into Mysql With Laravel

No i have button with v-on:click there is no input field as I only need to toggle the completed to true or false

v-on:click="toggleTodo(todo)"
Activity icon

Replied to Can't Save Boolean Into Mysql With Laravel

Actually i have my form in a vue js component, basically i have a button to trigger this method.

toggleTodo(e){
             e.completed = !e.completed
            let data = new FormData();
            data.append('_method', 'PATCH');
            data.append('completed', e.completed);
            axios.post('/api/todo/'+e.id, data).then((res) =>{
               
            }).catch((error) => {
                this.form.errors.record(error.response.data.errors)
            })
        },

Activity icon

Replied to Can't Save Boolean Into Mysql With Laravel

when i dd( $request->completed ); i get 1 but when i delete the dd and i try to update the database i receive the error above

Activity icon

Replied to Can't Save Boolean Into Mysql With Laravel

I know, as you can see i tried it with int $request->completed = 1;

Activity icon

Started a new Conversation Can't Save Boolean Into Mysql With Laravel

Hi, I am not able to save boolean into mysql database I have a the following message: "SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: 'true' for column

I have set the request-> completed value to 1 but i still have the error above

    public function update(Request $request, $id)
    {
        $todo = Vuejstodo::findOrFail($id);
       
       $request->completed = 1;

        $todo->update($request->all());
        $todo->save();

        return $todo;
    }
Jun
24
5 months ago
Activity icon

Started a new Conversation PDF As Image

Hi, Is there any option to display PDF files as image in laravel ? Basically i upload a PDF document and i would like to display the PDF content on my page as an image.

I wanted to use this package: https://github.com/spatie/pdf-to-image But exec() disabled on the server i use so this package is not an option for me.

Jun
16
5 months ago
Activity icon

Started a new Conversation How To Convert Associative Arrays To Indexed?

Basically i want to get from the users table only the email addresses. When i use the following code i get an associative array

  $emails = Users::select('email')->get()->toArray();

the output is :

$emails =
array:6 [
  0 => array:1 [
    "email" => "[email protected]"
  ]
  1 => array:1 [
    "email" => "[email protected]"
  ]
  2 => array:1 [
    "email" => "[email protected]"
  ]
  3 => array:1 [
    "email" => "[email protected]"
  ]
  4 => array:1 [
    "email" => "[email protected]"
  ]
  5 => array:1 [
    "email" => "[email protected]"
  ]
]

how to convert it to :

$emails = array("[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]")
Jun
15
5 months ago
Activity icon

Replied to How To Use Mailgun API To Send Emails To Multiple Users With Attachment

OMG!!! It was so easy! I literally spent more then a day installing mailgun/mailgun and different packages and testing them. Shame on me that i haven't read the documentation on the first place :/

Thanks!

Activity icon

Started a new Conversation How To Use Mailgun API To Send Emails To Multiple Users With Attachment

Hi, I am able to send emai with Mailgun API to 1 email adress but I am not sure how to sendsame email to multiple email addresses with attachment. And also i would like to send html message (view).

Has anyone have any experience on this field?

I have tried to use Bogardo/Mailgun package it would be great and easy to use, but i was not able to install this package. I think laravel 7 is not supported by this package.

Jun
12
5 months ago
Activity icon

Replied to How To Send Multiple Attachment In Laravel

Hi I am not sure if your problem sorted, but the following code is working perfectly for me, and I can send multiple attachment with the email. So here is the code:

Form:

<form action="" method="post" enctype="multipart/form-data">@csrf

    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">General Information</div>
                <div class="card-body">
                    <div class="form-group">
                
                    
                    <div id="person">

                        <select name="person" class="form-control">
                            <option value="">select</option>
                            @foreach(App\User::all() as $user)
                                <option value="{{$user->id}}">{{$user->name}}</option>
                            @endforeach
                        </select>
                    </div>
                        
                    </div>
                    <input type="file" name="file[]">
                    <div class="form-group">
                        <textarea name="body" class="form-control"></textarea>
                    </div>
                    
            <br>
            <div class="form-group">
                <button class="btn btn-primary " type="submit">Submit</button>
            </div>
        </div>
      
    </div>
</form>

My controller where i receive the post request: (I am sending the whole request to my sendmail.php

public function mailsend(Request $request)
	{

	$people = User::get();
		foreach($people as $p){
			Mail::to($p->email)
     			->send(new SendMail($request));
        	
			}
		}
		return redirect()->back();
    }

sendmail.php

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class SendMail extends Mailable
{
    use Queueable, SerializesModels;
    public $body;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($request)
    {
              $this->body = $request->body;
        	$this->attachment = $request->file;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {

	$mail = $this->subject('Mail from Real Programmer')->view('admin.emails.sendmail');
	
	if ($this->attachment) {
        foreach($this->attachment as $file)
            $mail->attach($file->getRealPath(), [
                'as' => $file->getClientOriginalName(), 
                'mime' => $file->getMimeType()
            ]);
        }
    }
}

So basically you only store the files temporary and send them.

Hope it helped to you.

Jun
11
5 months ago
Activity icon

Started a new Conversation Video Uploading

Hi guys, I would like to create website where i can upload videos and then display them on my website with video.js. Videos are usually big in file size. Is there any good practice how to upload videos with laravel on the website and save them on the server? should I use AWS or similar service to store my videos? Should be videos uploading async?

Jun
10
5 months ago
Activity icon

Awarded Best Reply on Get Comment Where Users Are Active

Found the solution

$comments= Comment::latest()->with('user')->whereHas('user', function($q){
            $q->where('status', 'active');
        })->get();