laravel-shortcodes
laravel-shortcodes copied to clipboard
create dynamic table row inserting through shortcodes
I'm trying to insert a table row/s dynamically through form by shortcodes functionality. shortcode : [post id="1,2,3"] I'm trying to insert table 'post' with id=['1', '2', '3'] rows with my form data. I have created a new shortcode called InsertAddShortcode and and register it in boot method of ShortcodeServiceProvider. I have made register method inside InsertAddShortcode.php
public function register($shortcode, $content, $compiler, $name, $viewData)
{
$query = $shortcode->table::find($shortcode->id);
return sprintf($shortcode->table=$query, $shortcode->id= $query->id, $shortcode->class, $content);
}
but it show error: Class name must be a valid object or a string.
I'm stuck in this process. Any advice, solution would be highly appreciated. Thanks in advance!!