übergeben Sie Parameter in der insert-Abfrage, die gespeicherte Prozedur in laravel 4
Habe ich eine Prozedur zum einfügen, aber weiß nicht, wie Aufruf-Parameter "name" und "Pfad" in controller-und Modell
Gespeicherte Prozedur:
CREATE DEFINER=`root`@`localhost`
PROCEDURE `insert_document_details`
(IN `name` VARCHAR(50), IN `path` VARCHAR(255) )
BEGIN
INSERT INTO `document_details`
(`document_name`, `document_path`)
VALUES (name,path);
END
Routen:
Route::post('insert_document_details/{name}/{path}',array('as'=>'insert_document_details',
'uses'=>'AuthorsController@post_document_details'));
AuthorController:
class AuthorsController extends BaseController{
public $restful = true;
public function post_document_details($name,$path)
{
$document_details=Response::json(Author::insert_document_details_Call());
return $document_details;
}
}
Autor(Modell):
class Author extends Eloquent {
public $table = 'document_details';
protected $primaryKey = 'id';
public static function insert_document_details_Call($name,$path)
{
return DB::select('call insert_document_details');
}
}
Du musst angemeldet sein, um einen Kommentar abzugeben.
Die zweite nimmt eine Liste der Parameter, die übergeben werden können, wie unten
oder