This file contains hidden or 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
class DataProcessController | |
{ | |
public function dataTableList(Request $request) | |
{ | |
$requestData = $request->all(); | |
$fdate = $requestData['columns'][0]['search']['value']; | |
$tdate = $requestData['columns'][1]['search']['value']; | |
$today = date('Y-m-d H:i:s'); | |
$columns = array( |
This file contains hidden or 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
200: OK. The standard success code and default option. | |
201: Object created. Useful for the store actions. | |
204: No content. When an action was executed successfully, but there is no content to return. | |
206: Partial content. Useful when you have to return a paginated list of resources. | |
400: Bad request. The standard option for requests that fail to pass validation. | |
401: Unauthorized. The user needs to be authenticated. | |
403: Forbidden. The user is authenticated, but does not have the permissions to perform an action. | |
404: Not found. This will be returned automatically by Laravel when the resource is not found. | |
500: Internal server error. Ideally you're not going to be explicitly returning this, but if something unexpected breaks, this is what your user is going to receive. | |
503: Service unavailable. Pretty self explanatory, but also another code that is not going to be returned explicitly by the application. |
This file contains hidden or 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 | |
$user = factory(User::class)->create([ | |
'email' => '[email protected]', | |
'password' => bcrypt('toptal123'), | |
]); | |
$payload = ['email' => '[email protected]', 'password' => 'toptal123']; | |
// 1 | |
$this->json('POST', 'api/login', $payload) |
This file contains hidden or 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 | |
// https://www.youtube.com/watch?v=zST3gGvnoww | |
//https://medium.com/@dinotedesco/laravel-api-resources-what-if-you-want-to-manipulate-your-models-before-transformation-8982846ad22c | |
// Routes | |
$app->get('products', 'ProductsController@index'); | |
$app->get('products/{id}', 'ProductsController@show'); | |
$app->put('products/{id}', 'ProductsController@update'); | |
$app->post('products', 'ProductsController@store'); |
This file contains hidden or 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
FROM php:7.0.4-fpm | |
RUN apt-get update && apt-get install -y libmcrypt-dev \ | |
mysql-client libmagickwand-dev --no-install-recommends \ | |
&& pecl install imagick \ | |
&& docker-php-ext-enable imagick \ | |
&& docker-php-ext-install mcrypt pdo_mysql |
This file contains hidden or 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
{ | |
"swagger": "2.0", | |
"info": { | |
"description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.", | |
"version": "1.0.0", | |
"title": "Swagger Petstore", | |
"termsOfService": "http://swagger.io/terms/", | |
"contact": { | |
"email": "[email protected]" | |
}, |
This file contains hidden or 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 | |
$strCsvFilePath = DIR_CSV . $strCsvFileName; // SaveDir | |
$strCsvDownloadUrl = URL_HOST . 'csv/' . $strCsvFileName; // Download Url | |
mb_language("Japanese"); | |
// Header | |
$strCsvFileText = file_get_contents($strCsvFilePath); | |
$from_encoding = CSV_ENCODE_AFTER; |
This file contains hidden or 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 | |
# CUSTOM DAILY LOG | |
// $app->configureMonologUsing(function($monolog) use ($app) { | |
// $monolog->pushHandler( | |
// (new Monolog\Handler\RotatingFileHandler( | |
// // Set the log path | |
// $app->storagePath().'/logs/app_error.log', | |
// // Set the number of daily files you want to keep | |
// $app->make('config')->get('app.log_max_files', 30) | |
// ))->setFormatter(new Monolog\Formatter\LineFormatter(null, null, true, true)) |
This file contains hidden or 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\Middleware; | |
use Closure; | |
use Illuminate\Http\Response; | |
/** | |
* Basic Auth / Basic認証の処理 | |
*/ |
This file contains hidden or 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
import { BASE_PATH, RESPONSE_OK } from '../../constants/Api'; | |
import axios from 'axios'; | |
export default class AbstractApi { | |
constructor() { | |
this.api = axios; | |
this.path = ''; | |
this.data = {}; | |
} |
OlderNewer