Skip to content

Instantly share code, notes, and snippets.

View zorca's full-sized avatar
✴️
Working from a faraway star

Zorca Orcinus zorca

✴️
Working from a faraway star
View GitHub Profile
Route::middleware([
'tenant-api',
InitializeTenancyByRequestData::class,
PreventAccessFromCentralDomains::class,
])->group(function () {
Route::get('tenants/current', 'TenantController@show');
Route::post('users/token', 'UserController@token');
Route::middleware(['auth:sanctum'])->group(function () {
Route::get('users/current', 'UserController@show');
});
{
"data": {
"articles": {
"data": [
{
"id": "1",
"deleted_at": null,
"title": "First Article",
"categories": [
{
@zorca
zorca / gist:e89a777e0c9082553db2f0c80d693b3a
Created April 8, 2020 07:10 — forked from bibendi/gist:7941823
Оформление коммитов

Для оформления сообщения коммита следует использовать следующий шаблон:

<type>(<scope>): <subject>
<BLANK LINE>
<body>

Заголовок

Тип коммита

@zorca
zorca / REST API.md
Created April 7, 2020 15:55 — forked from donyahmd/REST API.md
Best practices Laravel Rest API

Best practices написание REST-API

  • Имена полей в ответе задавать в snake_case (prr_page, created_at, system_name,...)
  • Для времени использовать ISO 8601 (формат: YYYY-MM-DDTHH:MM:SSZ)
  • Отдавать данные (сам контент, поля сущностей, массивы сущностей), помещая их в data

Использование REST методов и примеры url'ов

  • GET: /api/users — получить список пользователей;
  • GET: /api/users/123 — получить указанного пользователя;
  • POST: /api/users — создать нового пользователя;
@zorca
zorca / .gitignore
Created March 24, 2020 14:22 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
input:not([type=checkbox]):not([type=radio]),
textarea,
select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
input, select {
border: none;
&:focus {
window.onload = function () {
document.getElementById('rest-api-test').onclick = function() {
axios({
method: 'post',
url: '/wp-json/forms/v1/send/1',
headers: {
'Content-Type': 'application/json',
'X-WP-Nonce': window.themeVars._wpnonce
},
});
@zorca
zorca / my.cnf
Created March 7, 2020 11:52
DO 16G DROPLET Runcloud + MariaDB Config
# MariaDB database server configuration file.
#
# You can copy this file to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql