Hey I am trying to use livewire for the first time and I successfuly done the function and when its finish the function checkSingleLink() its shows this error :
"render" method on [App\Http\Livewire\SingleAsset] must return instance of [Illuminate\View\View]
the Livewire Model
namespace App\Http\Livewire;
use Illuminate\Http\Request;
use App\Models\Links;
use App\Models\Cron;
use Livewire\Component;
class SingleAsset extends Component
{
public $saved = False;
protected $fillable = [
'keyword', 'data', 'updated_at'
];
public function __construct() {
$this->cron = new Cron();
}
public function render(Request $request)
{
if(Links::where('asset_id', '=', $request->id)->exists()){
$links = Links::where('asset_id', '=', $request->id)->get();
return view('livewire.single-asset', compact('links'));
}
}
public function checkSingleLink(Links $link, $keyword) {
// cron::fetchUrl($link->link, $keyword);
$data = $this->cron->fetchUrl($link->link, $keyword);
$link->keyword = $keyword;
$link->data = $data;
$link->save();
// dd($this->cron->fetchUrl($link->link, $keyword));
session()->flash('message', "link checked");
$this->saved = TRUE;
}
}
this is the location where I call the function
<input class="inputs" style="border:0;" type="text" value="{{$link->keyword}}" wire:keydown.enter="checkSingleLink({{$link}}, $event.target.value)"/>
this part of the calling and making the function working but after when he need to render again the response its not working