Martin1182

Web Developer at Programer

Member Since 1 Year Ago

Zvolen

Experience Points
3,640
Total
Experience

1,360 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
20
Lessons
Completed
Best Reply Awards
0
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.

  • Community Pillar

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

Level 1
3,640 XP
Dec
08
1 month ago
Activity icon

Replied to Validation Failed

Thanks for forgetting this

Activity icon

Replied to Validation Failed

yes i tried it but it didn't help

Activity icon

Started a new Conversation Validation Failed

I need to register users via API. The problem will do RegisterRequest just don't know why. The response comes in 404 Validation also fails when users log in ... it also returns 404 in postman as in the picture.


<?php


use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

use App\Http\Controllers\Auth\LoginController;
use App\Http\Controllers\Auth\RegisterController;
use App\Http\Controllers\Products\ProductController;
use App\Http\Controllers\Categories\CategoryController;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::resource('categories', CategoryController::class);
Route::resource('products', ProductController::class);

Route::group(['prefix' => 'auth'], function () {
    Route::post('register', [RegisterController::class, 'action']);
    Route::post('login', [LoginController::class, 'action']);
});




namespace App\Http\Controllers\Auth;

use App\Models\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\RegisterRequest;
use App\Http\Resources\PrivateUserResource;

class RegisterController extends Controller
{

    public function action(RegisterRequest $request)
    {
        $user = User::create($request->only('email', 'name', 'password'));

        return new PrivateUserResource($user);
    }
}


namespace App\Http\Requests\Auth;

use Illuminate\Foundation\Http\FormRequest;

class RegisterRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {

        return [
            'email' => 'required|email|unique:users,email',
            'name' => 'required',
            'password' => 'required',
        ];
    }
}


namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class PrivateUserResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'email' => $this->email,
            'name' => $this->name,
        ];
    }
}

Activity icon

Replied to RegisterRequest

I tried it nothing changed 404 still

Activity icon

Started a new Conversation RegisterRequest

I need to register users via API. The problem will do RegisterRequest just don't know why. The response comes in 404 Validation also fails when users log in ... it also returns 404 in postman as in the picture.

Route::group(['prefix' => 'auth'], function () {
    Route::post('register', [RegisterController::class, 'action']);
});

namespace App\Http\Controllers\Auth;

use App\Models\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\RegisterRequest;
use App\Http\Resources\PrivateUserResource;

class RegisterController extends Controller
{

    public function action(RegisterRequest $request)
    {
        $user = User::create($request->only('email', 'name', 'password'));

        return new PrivateUserResource($user);
    }
}


namespace App\Http\Requests\Auth;

use Illuminate\Foundation\Http\FormRequest;

class RegisterRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {

        return [
            'email' => 'required|email|unique:users,email',
            'name' => 'required',
            'password' => 'required',
        ];
    }
}




namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class PrivateUserResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'email' => $this->email,
            'name' => $this->name,
        ];
    }
}



Dec
04
1 month ago
Activity icon

Replied to RegisterRequest

if is rules empty and the correct post request without key & value I get 500. It's SQL error General error: 1364 Field 'name' doesn't have a default value. But when I uncomment the rules respose is 404.

Activity icon

Replied to RegisterRequest

I emptied the field and returning a 500 sql error sending an empty form

Activity icon

Replied to RegisterRequest

Yes, /api/auth/register

Activity icon

Replied to RegisterRequest

Thank you but this did not solve my problem

Activity icon

Replied to RegisterRequest

I have a registered user. As soon as I use registerRequest instead of Request it should start validating but instead it returns me 404 I don't get it ...

Activity icon

Replied to RegisterRequest

Thank you for your response. Yes url I have the correct api/auth/register

Activity icon

Started a new Conversation RegisterRequest

I need to register users via API. The problem will do RegisterRequest just don't know why. The response comes in 404

Route


Route::group(['prefix' => 'auth'], function () {
    Route::post('register', [RegisterController::class, 'action']);
});


Controller


namespace App\Http\Controllers\Auth;

use App\Models\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\RegisterRequest;
use App\Http\Resources\PrivateUserResource;

class RegisterController extends Controller
{

    public function action(RegisterRequest $request)
    {
        $user = User::create($request->only('email', 'name', 'password'));

        return new PrivateUserResource($user);
    }
}


RegisterRequest


namespace App\Http\Requests\Auth;

use Illuminate\Foundation\Http\FormRequest;

class RegisterRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {

        return [
            'email' => 'required|email|unique:users,email',
            'name' => 'required',
            'password' => 'required',
        ];
    }
}


PrivateUserResource


namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class PrivateUserResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'email' => $this->email,
            'name' => $this->name,
        ];
    }
}


Nov
29
1 month ago
Activity icon

Replied to Nuxt.js Axios Call -> Laravel Api

Thanks for the reply but even that didn't help me. The state is still empty ...

Nov
28
1 month ago
Activity icon

Replied to Nuxt.js Axios Call -> Laravel Api

Well, when I call it like this outside of vuex, it's a pride response like I expect ... But why doesn't it work via vuex ???

   methods:{
	fetchSomeCategories(){
  		this.$axios.$get('categories').then(response => {
  			console.log(response.data)
		}).catch(err => {
			console.error(err.response.data)
		})
 	}
},
mounted() {
	this.fetchSomeCategories()
}

response...ok

[{…}]
0:
children: Array(1)
0: {name: "Two", slug: "two"}
length: 1
__proto__: Array(0)
name: "One"
slug: "one"
__proto__: Object
length: 1
__proto__: Array(0)

Activity icon

Replied to Nuxt.js Axios Call -> Laravel Api

Thank you, but it didn't help

Activity icon

Started a new Conversation Nuxt.js Axios Call -> Laravel Api

Hi, could anyone help me? I can't connect to the backend of the application. I'm not getting any bugs just the store won't fill it with data. I checked the API via postman and there it's all ok the data is coming back with the app. I use Nuxt.js and the code I have the following ...

store

index.js

export const state = () => ({
  categories: []

})
export const getters = {
 categories(state) {
    return state.categories
  }
}
export const mutations = {
  SET_CATEGORIES(state, categories) {
    state.categories = categories
  }
}
export const actions = { 
  async nuxtServerInit({ commit }) {
    let response = await this.$axios.$get('categories')

    commit('SET_CATEGORIES', response.data)
  }
}

nuxt.config.js

export default {
  // Disable server-side rendering (https://go.nuxtjs.dev/ssr-mode)
  ssr: false,

  // Global page headers (https://go.nuxtjs.dev/config-head)
  head: {
    title: 'shopclient',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },

  // Global CSS (https://go.nuxtjs.dev/config-css)
  css: [
  ],

  // Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
  plugins: [
  ],

  // Auto import components (https://go.nuxtjs.dev/config-components)
  components: true,

  // Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
  buildModules: [
    // https://go.nuxtjs.dev/tailwindcss
    '@nuxtjs/tailwindcss',
  ],

  // Modules (https://go.nuxtjs.dev/config-modules)
  modules: [
    '@nuxtjs/axios'
  ],
  axios: {
    baseURL: 'http://127.0.0.1:8000/api',
  },

  // Build Configuration (https://go.nuxtjs.dev/config-build)
  build: {
  }
}

Nov
21
2 months ago
Activity icon

Replied to Page Navigation Gsap

Thanks for trying but I'm still unsuccessful. I'm going to keep trying

Activity icon

Replied to Page Navigation Gsap

Thank you for your response

Yes I tried, it didn't help I don't understand why it doesn't work on iPhones

Activity icon

Started a new Conversation Page Navigation Gsap

Hi, I'm doing navigation and using gsap. Everything is fine except for ios ... you don't know why? IOS / IPhone will automatically exit after clicking on that showButton. reverse. The console does not throw any err.

const showButton = document.querySelector('#navToggleShow');
const overlay = document.querySelector('.overlay__navigation');
const exit = document.querySelector('#exitBtn');
var tl = gsap.timeline({ defaults: { duration: 1, ease: "Back.easeOut.config(2)" }})
tl.paused(true);
tl.to(overlay, { clipPath: 'circle(100%)' })
tl.to(".menu__container", { opacity: 1, y: '30px', stagger: 0.1 }, "-=1")
showButton.addEventListener('click', () => {
tl.play();
})
exit.addEventListener('click', () => {
tl.reverse(.7);
})

The application is built on Laravel, so we use a webpack. THX

https://www.automatik.sk

Oct
28
2 months ago
Activity icon

Started a new Conversation Add Products Images (NOVA ADMIN)

Hi, how can we best add images to products in the nova admin panel? Thank you

Oct
27
2 months ago
Activity icon

Started a new Conversation Advanced Nova Media Library

I'm trying to use the Advanced Nova Media Library package and I have a problem with registration.

I have created a Car and db model in which, among other things, I also register car_images where, with the help of the Nova Media Library, pictures for each car are to be stored.

When I paste the code below into my nova model I get this error: Call to undefined method App\Models\Car::getMedia()


use Spatie\MediaLibrary\Models\Media;

public function registerMediaConversions(Media $media = null)
{
    $this->addMediaConversion('thumb')
        ->width(130)
        ->height(130);
}

public function registerMediaCollections()
{
    $this->addMediaCollection('main')->singleFile();
    $this->addMediaCollection('my_multi_collection');
}


 /**
	 * Get the gallery fields for the resource.
	 *
	 * @return array
	 */
    protected function galleryFields()
    {
        return [
            /* Files::make('Single file', 'one_file'), */
            Files::make('Multiple files', 'car_images'),
        ];
    }

Can anyone fix me what I'm doing?

Oct
26
2 months ago
Activity icon

Started a new Conversation Multiple Images Laravel Nova

I need to create an image gallery. I have a Car model I need to add a picture gallery to it. I would like to use Laravel Advanced Nova Media Library. How do I use this package? Well thank you. Mammodel Car where I need a gallery of pictures for a specific car. Should I register this packagev model nova or not? well thank you.

Jul
23
5 months ago
Activity icon

Started a new Conversation Generate PDF Invoice

Good day

Can you advise me on the best way to add another $ products variable to the function? I need the invoice blade then run through the foreach table of products. well thank you

class InvoiceController extends Controller
{
    public function downloadPDF($id)
    {
        $order = Order::find($id);
        $pdf = PDF::loadView('invoice', compact('order'));

        return $pdf->download('invoice.pdf');
    }
}

That's not how it works for me


class InvoiceController extends Controller
{
    public function downloadPDF($id)
    {
        $order = Order::find($id);
        $products = $order->products;
        $pdf = PDF::loadView('invoice', compact('order', 'products'));

        return $pdf->download('invoice.pdf');
    }
}