Skip to content

Dostawa online dla restauracji, produkty, warianty produktów, dodatki, grupy dodatków, koszyk z api, kategorie, zamówienia, płatności payu itp. (przykłady).

Notifications You must be signed in to change notification settings

atomjoy/cartelo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cartelo

Dostawa online dla restauracji, produkty, warianty produktów, dodatki, grupy dodatków, koszyk z api, kategorie, zamówienia, płatności payu itp. (przykłady).

Klasa użytkownika

app/Models/User.php

<?php

namespace App\Models;

use Cartelo\Models\User as CarteloUser;

class User extends CarteloUser
{
  function __construct(array $attributes = [])
  {
    parent::__construct($attributes);

    $this->mergeFillable([
      // 'mobile', 'website'
    ]);

    $this->mergeCasts([
      // 'status' => StatusEnum::class,
      // 'email_verified_at' => 'datetime:Y-m-d H:i:s',
    ]);

    // $this->hidden[] = 'secret_hash';
  }

  protected $dispatchesEvents = [
    // 'saved' => UserSaved::class,
    // 'deleted' => UserDeleted::class,
  ];
}

Klasa zamówień

app/Models/Order.php

<?php

namespace App\Models;

use Cartelo\Models\Order as CarteloOrder;

class Order extends CarteloOrder
{
}

Dodaj plik konfiguracji atomjoy/payu

config/payu.php

php artisan vendor:publish --tag=payu-config

Migracja tabel

# Aktualizuj
php artisan migrate

# Nowe
php artisan migrate:fresh
php artisan migrate:fresh --env=testing

Punkty końcowe interfejsu API

php artisan route:list

Błędy

sudo mkdir -p storage/framework/cache/payu
sudo chown -R www-data:www-data storage/framework/cache/payu
sudo chmod -R 770 storage/framework/cache/payu

Dodaj w app/Exceptions/Handler.php dla tłumaczeń

use Illuminate\Auth\AuthenticationException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

public function register()
{
  $this->renderable(function (AuthenticationException $e, $request) {
   if ($request->is('web/api/*') || $request->wantsJson()) {
    return response()->errors($e->getMessage(), 401);
   }
  });

  $this->renderable(function (NotFoundHttpException $e, $request) {
   if ($request->is('web/api/*') || $request->wantsJson()) {
    return response()->errors('Not Found.', 404);
   }
  });
}

About

Dostawa online dla restauracji, produkty, warianty produktów, dodatki, grupy dodatków, koszyk z api, kategorie, zamówienia, płatności payu itp. (przykłady).

Topics

Resources

Stars

Watchers

Forks

Languages