Skip to content

Instantly share code, notes, and snippets.

View Tjoosten's full-sized avatar
🌏
Somewhere between home and Hogwarts School of Witchcraft and Wizardry

Tim Joosten Tjoosten

🌏
Somewhere between home and Hogwarts School of Witchcraft and Wizardry
  • Polar Youth
  • Antwerp, BE
  • 00:04 (UTC +02:00)
  • X @x0rif
View GitHub Profile
public function postRegister() {
$validator = Validator::make(
['firstname' => ['required', 'alpha', 'min:2']],
['lastname' => ['required', 'alpha', 'min:2']],
['email' => ['required', 'email', 'unique:users']],
['password_confirmation' => ['required', 'alpha_num', 'between6,12']],
['password' => ['required', 'aplha_num', 'between:6,12', 'confirmed']]
);
if($validator->passes()) {
/**
* Display all the soldiers.
*
* @access public
* @link GET /soldiers/all
* @return Response
*/
public function Soldiers() {
return response()->json([
'error' => false,
$resource = new Collection($variable['result'], function($Data) {
return [
[
'id' => (int) $Data['id'],
'Voornaam' => (string) $Data['Voornaam'],
'Achternaam' => (string) $Data['Achternaam'],
'Burgerlijke stand' => (string) $Data['Burgerlijke_stand'],
'Dienst nr' => (string) $Data['Stam_nr'],
'Regiment ID' => (int) $Data['regiment_id'],
'Regiment' => (string) $Data['regiment']['Regiment'],
public function insertRegiment(Request $request) {
$v = Validator::make($request->all()), [
'Regiment' => 'A regiment name is required'
]);
if ($v->fails()) {
return 'meh';
}
array(2) {
["data"]=>
array(5) {
[0]=>
array(1) {
[0]=>
array(24) {
["id"]=>
int(1)
["Voornaam"]=>
<?php
// PHP information
// You can search it. By pressing ctrl+F (Windows) or cmd+F (OSX)
// And type Openssl.
phpinfo();
// Upload this file trough SFTP of SSH.
// And Call it trough the browser.
// http://www.<domain>.<tld>/<path/to/file>
ErrorException in compiled.php line 2506:
Trying to get property of non-object
in compiled.php line 2506
at HandleExceptions->handleError('8', 'Trying to get property of non-object', '/Users/tim/Documents/Miet-Ooms/laravel/vendor/compiled.php', '2506', array('request' => object(Request), 'response' => null)) in compiled.php line 2506
at VerifyCsrfToken->addCookieToResponse(object(Request), null) in compiled.php line 2492
at VerifyCsrfToken->handle(object(Request), object(Closure)) in VerifyCsrfToken.php line 17
at VerifyCsrfToken->handle(object(Request), object(Closure)) in compiled.php line 9059
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 12216
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in compiled.php line 9059
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 10917

Stuff I did to debug during API dev on my local machine

Run the PHP dev server on your given port

php -S 0.0.0.0:8080 -t public public/index.php

In httpie, pass ?XDEBUG_SESSION_START=foobar on the query string with the request

@Tjoosten
Tjoosten / api.php
Created June 22, 2015 20:58
command: curl -H "Content-Type: application/php" -X DELETE http://localhost:8000/api/user/1
/**
* @api {delete} /api/user/{id} Verwijder gebruiker
* @apiGroup Gebruikers
* @apiVersion 1.0.0
* @apiName Deleteuser
*
* @apiParam {integer} id De unieke id van de gebruiker.
*/
public function destroy($id, Request $request)
{
----------------------------------------------------------------------
FILE ERRORS WARNINGS
----------------------------------------------------------------------
/Users/tim/Desktop/irail-work/api/APICall.php 3 1
/Users/tim/Desktop/irail-work/api/connections.php 1 1
/Users/tim/Desktop/irail-work/api/data/DataRoot.php 2 1
/Users/tim/Desktop/irail-work/api/data/DL/tools.php 98 3
...im/Desktop/irail-work/api/data/MIVB/liveboard.php 1 5
...tim/Desktop/irail-work/api/data/MIVB/stations.php 3 3
.../Desktop/irail-work/api/data/NMBS/connections.php 4 26