Created
October 8, 2019 09:36
-
-
Save einnar82/bc8c59d27a8de5b0005c74d0f3468a2d to your computer and use it in GitHub Desktop.
Stored Procedure PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use App\Model\Notification; | |
use App\Abstracts\Controllers\ApiController; | |
use Doctrine\DBAL\Driver\PDOConnection; | |
use Illuminate\Http\Request; | |
class StoredProcController extends ApiController | |
{ | |
public function start(Request $request) { | |
$db = \DB::connection()->getPdo(); | |
$db->setAttribute(PDOConnection::ATTR_ERRMODE, PDOConnection::ERRMODE_EXCEPTION); | |
$db->setAttribute(PDOConnection::ATTR_EMULATE_PREPARES, true); | |
$res = $db->prepare('CALL getAllNotifications()'); | |
$res->execute(); | |
$data = $res->fetchAll(PDOConnection::FETCH_ASSOC); | |
$res->closeCursor(); | |
return $data; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment