<?php

namespace App\View\Components;

use Illuminate\View\Component;

class Captcha extends Component
{
    /**
     * Create a new component instance.
     *
     * @return void
     */

    public $path;
    public $hasLabel;

    public function __construct($path = null, $hasLabel=false)
    {
        $this->path = $path;
        $this->hasLabel = $hasLabel;
    }

    /**
     * Get the view / contents that represent the component.
     *
     * @return \Illuminate\Contracts\View\View|\Closure|string
     */
    public function render()
    {
        if ($this->path) {
            return view($this->path.'.captcha');
        }
        $hasLabel = $this->hasLabel;
        return view('partials.captcha',compact('hasLabel'));
    }
}
