repo stringlengths 7 63 | file_url stringlengths 81 284 | file_path stringlengths 5 200 | content stringlengths 0 32.8k | language stringclasses 1 value | license stringclasses 7 values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:02:33 2026-01-05 05:24:06 | truncated bool 2 classes |
|---|---|---|---|---|---|---|---|---|
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/Context/ProductOptionsContextSpec.php | spec/Context/ProductOptionsContextSpec.php | <?php
/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.shop and write us
* an email on mikolaj.krol@bitbag.pl.
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\Context;
use BitBag\SyliusElasticsearchPlugin\Context\ProductOptionsContext;
use BitBag\SyliusElasticsearchPlugin\Context\ProductOptionsContextInterface;
use BitBag\SyliusElasticsearchPlugin\Context\TaxonContextInterface;
use BitBag\SyliusElasticsearchPlugin\Finder\ProductOptionsFinderInterface;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Core\Model\TaxonInterface;
final class ProductOptionsContextSpec extends ObjectBehavior
{
function let(
TaxonContextInterface $taxonContext,
ProductOptionsFinderInterface $optionsFinder
): void {
$this->beConstructedWith($taxonContext, $optionsFinder);
}
function it_is_initializable(): void
{
$this->shouldHaveType(ProductOptionsContext::class);
}
function it_implements_product_options_context_interface(): void
{
$this->shouldHaveType(ProductOptionsContextInterface::class);
}
function it_gets_options(
TaxonContextInterface $taxonContext,
ProductOptionsFinderInterface $optionsFinder,
TaxonInterface $taxon
): void {
$taxonContext->getTaxon()->willReturn($taxon);
$optionsFinder->findByTaxon($taxon)->willReturn([]);
$this->getOptions()->shouldBeEqualTo([]);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/PropertyBuilder/OptionBuilderSpec.php | spec/PropertyBuilder/OptionBuilderSpec.php | <?php
/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.shop and write us
* an email on mikolaj.krol@bitbag.pl.
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\PropertyBuilder;
use BitBag\SyliusElasticsearchPlugin\Formatter\StringFormatterInterface;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\AbstractBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\OptionBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\PropertyBuilderInterface;
use BitBag\SyliusElasticsearchPlugin\PropertyNameResolver\ConcatedNameResolverInterface;
use Elastica\Document;
use FOS\ElasticaBundle\Event\PostTransformEvent;
use PhpSpec\ObjectBehavior;
final class OptionBuilderSpec extends ObjectBehavior
{
function let(
ConcatedNameResolverInterface $optionNameResolver,
StringFormatterInterface $stringFormatter
): void {
$this->beConstructedWith($optionNameResolver, $stringFormatter);
}
function it_is_initializable(): void
{
$this->shouldHaveType(OptionBuilder::class);
$this->shouldHaveType(AbstractBuilder::class);
}
function it_implements_property_builder_interface(): void
{
$this->shouldHaveType(PropertyBuilderInterface::class);
}
function it_consumes_event(Document $document, $object): void
{
$event = new PostTransformEvent($document->getWrappedObject(), [], $object->getWrappedObject());
$this->consumeEvent($event);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/PropertyBuilder/ProductTaxonsBuilderSpec.php | spec/PropertyBuilder/ProductTaxonsBuilderSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\PropertyBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\AbstractBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\Mapper\ProductTaxonsMapperInterface;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\ProductTaxonsBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\PropertyBuilderInterface;
use Elastica\Document;
use FOS\ElasticaBundle\Event\PostTransformEvent;
use PhpSpec\ObjectBehavior;
final class ProductTaxonsBuilderSpec extends ObjectBehavior
{
function let(ProductTaxonsMapperInterface $productTaxonsMapper): void
{
$this->beConstructedWith($productTaxonsMapper, 'taxons');
}
function it_is_initializable(): void
{
$this->shouldHaveType(ProductTaxonsBuilder::class);
$this->shouldHaveType(AbstractBuilder::class);
}
function it_implements_property_builder_interface(): void
{
$this->shouldHaveType(PropertyBuilderInterface::class);
}
function it_consumes_event(Document $document, $object): void
{
$event = new PostTransformEvent($document->getWrappedObject(), [], $object->getWrappedObject());
$this->consumeEvent($event);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/PropertyBuilder/OptionTaxonsBuilderSpec.php | spec/PropertyBuilder/OptionTaxonsBuilderSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\PropertyBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\AbstractBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\Mapper\ProductTaxonsMapperInterface;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\OptionTaxonsBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\PropertyBuilderInterface;
use BitBag\SyliusElasticsearchPlugin\Repository\ProductVariantRepositoryInterface;
use Elastica\Document;
use FOS\ElasticaBundle\Event\PostTransformEvent;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Resource\Repository\RepositoryInterface;
final class OptionTaxonsBuilderSpec extends ObjectBehavior
{
function let(
RepositoryInterface $productOptionValueRepository,
ProductVariantRepositoryInterface $productVariantRepository,
ProductTaxonsMapperInterface $productTaxonsMapper
): void {
$this->beConstructedWith(
$productOptionValueRepository,
$productVariantRepository,
$productTaxonsMapper,
'taxons'
);
}
function it_is_initializable(): void
{
$this->shouldHaveType(OptionTaxonsBuilder::class);
$this->shouldHaveType(AbstractBuilder::class);
}
function it_implements_property_builder_interface(): void
{
$this->shouldHaveType(PropertyBuilderInterface::class);
}
function it_consumes_event(Document $document, $object): void
{
$event = new PostTransformEvent($document->getWrappedObject(), [], $object->getWrappedObject());
$this->consumeEvent($event);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/PropertyBuilder/ChannelsBuilderSpec.php | spec/PropertyBuilder/ChannelsBuilderSpec.php | <?php
/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.shop and write us
* an email on mikolaj.krol@bitbag.pl.
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\PropertyBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\AbstractBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\ChannelsBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\PropertyBuilderInterface;
use Elastica\Document;
use FOS\ElasticaBundle\Event\PostTransformEvent;
use PhpSpec\ObjectBehavior;
final class ChannelsBuilderSpec extends ObjectBehavior
{
function let(): void
{
$this->beConstructedWith('channels');
}
function it_is_initializable(): void
{
$this->shouldHaveType(ChannelsBuilder::class);
$this->shouldHaveType(AbstractBuilder::class);
}
function it_implements_property_builder_interface(): void
{
$this->shouldHaveType(PropertyBuilderInterface::class);
}
function it_consumes_event(Document $document, $object): void
{
$event = new PostTransformEvent($document->getWrappedObject(), [], $object->getWrappedObject());
$this->consumeEvent($event);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/PropertyBuilder/ProductDescriptionBuilderSpec.php | spec/PropertyBuilder/ProductDescriptionBuilderSpec.php | <?php
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\PropertyBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\AbstractBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\ProductDescriptionBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\PropertyBuilderInterface;
use BitBag\SyliusElasticsearchPlugin\PropertyNameResolver\ConcatedNameResolverInterface;
use Elastica\Document;
use FOS\ElasticaBundle\Event\PostTransformEvent;
use PhpSpec\ObjectBehavior;
final class ProductDescriptionBuilderSpec extends ObjectBehavior
{
function let(ConcatedNameResolverInterface $productNameNameResolver): void
{
$this->beConstructedWith($productNameNameResolver);
}
function it_is_initializable(): void
{
$this->shouldHaveType(ProductDescriptionBuilder::class);
$this->shouldHaveType(AbstractBuilder::class);
}
function it_implements_property_builder_interface(): void
{
$this->shouldHaveType(PropertyBuilderInterface::class);
}
function it_consumes_event(Document $document, $object): void
{
$event = new PostTransformEvent($document->getWrappedObject(), [], $object->getWrappedObject());
$this->consumeEvent($event);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/PropertyBuilder/AttributeBuilderSpec.php | spec/PropertyBuilder/AttributeBuilderSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\PropertyBuilder;
use BitBag\SyliusElasticsearchPlugin\Formatter\StringFormatterInterface;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\AbstractBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\AttributeBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\PropertyBuilderInterface;
use BitBag\SyliusElasticsearchPlugin\PropertyNameResolver\ConcatedNameResolverInterface;
use Elastica\Document;
use FOS\ElasticaBundle\Event\PostTransformEvent;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Locale\Context\LocaleContextInterface;
final class AttributeBuilderSpec extends ObjectBehavior
{
function let(
ConcatedNameResolverInterface $attributeNameResolver,
StringFormatterInterface $stringFormatter,
LocaleContextInterface $localeContext
): void {
$this->beConstructedWith(
$attributeNameResolver,
$stringFormatter,
$localeContext
);
}
function it_is_initializable(): void
{
$this->shouldHaveType(AttributeBuilder::class);
$this->shouldHaveType(AbstractBuilder::class);
}
function it_implements_property_builder_interface(): void
{
$this->shouldHaveType(PropertyBuilderInterface::class);
}
function it_consumes_event(Document $document, $object): void
{
$event = new PostTransformEvent($document->getWrappedObject(), [], $object->getWrappedObject());
$this->consumeEvent($event);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/PropertyBuilder/ProductNameBuilderSpec.php | spec/PropertyBuilder/ProductNameBuilderSpec.php | <?php
/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.shop and write us
* an email on mikolaj.krol@bitbag.pl.
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\PropertyBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\AbstractBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\ProductNameBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\PropertyBuilderInterface;
use BitBag\SyliusElasticsearchPlugin\PropertyNameResolver\ConcatedNameResolverInterface;
use Elastica\Document;
use FOS\ElasticaBundle\Event\PostTransformEvent;
use PhpSpec\ObjectBehavior;
final class ProductNameBuilderSpec extends ObjectBehavior
{
function let(ConcatedNameResolverInterface $productNameNameResolver): void
{
$this->beConstructedWith($productNameNameResolver);
}
function it_is_initializable(): void
{
$this->shouldHaveType(ProductNameBuilder::class);
$this->shouldHaveType(AbstractBuilder::class);
}
function it_implements_property_builder_interface(): void
{
$this->shouldHaveType(PropertyBuilderInterface::class);
}
function it_consumes_event(Document $document, $object): void
{
$event = new PostTransformEvent($document->getWrappedObject(), [], $object->getWrappedObject());
$this->consumeEvent($event);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/PropertyBuilder/ProductCreatedAtPropertyBuilderSpec.php | spec/PropertyBuilder/ProductCreatedAtPropertyBuilderSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\PropertyBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\AbstractBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\ProductCreatedAtPropertyBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\PropertyBuilderInterface;
use Elastica\Document;
use FOS\ElasticaBundle\Event\PostTransformEvent;
use PhpSpec\ObjectBehavior;
final class ProductCreatedAtPropertyBuilderSpec extends ObjectBehavior
{
function let(): void
{
$this->beConstructedWith('created_at');
}
function it_is_initializable(): void
{
$this->shouldHaveType(ProductCreatedAtPropertyBuilder::class);
$this->shouldHaveType(AbstractBuilder::class);
}
function it_implements_property_builder_interface(): void
{
$this->shouldHaveType(PropertyBuilderInterface::class);
}
function it_consumes_event(Document $document, $object): void
{
$event = new PostTransformEvent($document->getWrappedObject(), [], $object->getWrappedObject());
$this->consumeEvent($event);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/PropertyBuilder/ChannelPricingBuilderSpec.php | spec/PropertyBuilder/ChannelPricingBuilderSpec.php | <?php
/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.shop and write us
* an email on mikolaj.krol@bitbag.pl.
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\PropertyBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\AbstractBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\ChannelPricingBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\PropertyBuilderInterface;
use BitBag\SyliusElasticsearchPlugin\PropertyNameResolver\ConcatedNameResolverInterface;
use Elastica\Document;
use FOS\ElasticaBundle\Event\PostTransformEvent;
use PhpSpec\ObjectBehavior;
final class ChannelPricingBuilderSpec extends ObjectBehavior
{
function let(
ConcatedNameResolverInterface $channelPricingNameResolver
): void {
$this->beConstructedWith(
$channelPricingNameResolver
);
}
function it_is_initializable(): void
{
$this->shouldHaveType(ChannelPricingBuilder::class);
$this->shouldHaveType(AbstractBuilder::class);
}
function it_implements_property_builder_interface(): void
{
$this->shouldHaveType(PropertyBuilderInterface::class);
}
function it_consumes_event(Document $document, $object): void
{
$event = new PostTransformEvent($document->getWrappedObject(), [], $object->getWrappedObject());
$this->consumeEvent($event);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/PropertyBuilder/ProductShortDescriptionBuilderSpec.php | spec/PropertyBuilder/ProductShortDescriptionBuilderSpec.php | <?php
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\PropertyBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\AbstractBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\ProductShortDescriptionBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\PropertyBuilderInterface;
use BitBag\SyliusElasticsearchPlugin\PropertyNameResolver\ConcatedNameResolverInterface;
use Elastica\Document;
use FOS\ElasticaBundle\Event\PostTransformEvent;
use PhpSpec\ObjectBehavior;
final class ProductShortDescriptionBuilderSpec extends ObjectBehavior
{
function let(ConcatedNameResolverInterface $productNameNameResolver): void
{
$this->beConstructedWith($productNameNameResolver);
}
function it_is_initializable(): void
{
$this->shouldHaveType(ProductShortDescriptionBuilder::class);
$this->shouldHaveType(AbstractBuilder::class);
}
function it_implements_property_builder_interface(): void
{
$this->shouldHaveType(PropertyBuilderInterface::class);
}
function it_consumes_event(Document $document, $object): void
{
$event = new PostTransformEvent($document->getWrappedObject(), [], $object->getWrappedObject());
$this->consumeEvent($event);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/PropertyBuilder/AttributeTaxonsBuilderSpec.php | spec/PropertyBuilder/AttributeTaxonsBuilderSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\PropertyBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\AbstractBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\AttributeTaxonsBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\PropertyBuilderInterface;
use BitBag\SyliusElasticsearchPlugin\Repository\TaxonRepositoryInterface;
use Elastica\Document;
use FOS\ElasticaBundle\Event\PostTransformEvent;
use PhpSpec\ObjectBehavior;
final class AttributeTaxonsBuilderSpec extends ObjectBehavior
{
function let(TaxonRepositoryInterface $taxonRepository): void
{
$this->beConstructedWith(
$taxonRepository,
'taxons',
true
);
}
function it_is_initializable(): void
{
$this->shouldHaveType(AttributeTaxonsBuilder::class);
$this->shouldHaveType(AbstractBuilder::class);
}
function it_implements_property_builder_interface(): void
{
$this->shouldHaveType(PropertyBuilderInterface::class);
}
function it_consumes_event(Document $document, $object): void
{
$event = new PostTransformEvent($document->getWrappedObject(), [], $object->getWrappedObject());
$this->consumeEvent($event);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/PropertyBuilder/SoldUnitsPropertyBuilderSpec.php | spec/PropertyBuilder/SoldUnitsPropertyBuilderSpec.php | <?php
/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.shop and write us
* an email on mikolaj.krol@bitbag.pl.
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\PropertyBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\AbstractBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\PropertyBuilderInterface;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\SoldUnitsPropertyBuilder;
use BitBag\SyliusElasticsearchPlugin\Repository\OrderItemRepositoryInterface;
use Elastica\Document;
use FOS\ElasticaBundle\Event\PostTransformEvent;
use PhpSpec\ObjectBehavior;
final class SoldUnitsPropertyBuilderSpec extends ObjectBehavior
{
function let(OrderItemRepositoryInterface $orderItemRepository): void
{
$this->beConstructedWith($orderItemRepository, 'sold_units');
}
function it_is_initializable(): void
{
$this->shouldHaveType(SoldUnitsPropertyBuilder::class);
$this->shouldHaveType(AbstractBuilder::class);
}
function it_implements_property_builder_interface(): void
{
$this->shouldHaveType(PropertyBuilderInterface::class);
}
function it_consumes_event(Document $document, $object): void
{
$event = new PostTransformEvent($document->getWrappedObject(), [], $object->getWrappedObject());
$this->consumeEvent($event);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/PropertyBuilder/Mapper/ProductTaxonsMapperSpec.php | spec/PropertyBuilder/Mapper/ProductTaxonsMapperSpec.php | <?php
/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.shop and write us
* an email on mikolaj.krol@bitbag.pl.
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\PropertyBuilder\Mapper;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\Mapper\ProductTaxonsMapper;
use BitBag\SyliusElasticsearchPlugin\PropertyBuilder\Mapper\ProductTaxonsMapperInterface;
use Doctrine\Common\Collections\Collection;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Model\TaxonInterface;
final class ProductTaxonsMapperSpec extends ObjectBehavior
{
function let(): void
{
$this->beConstructedWith(
true
);
}
function it_is_initializable(): void
{
$this->shouldHaveType(ProductTaxonsMapper::class);
}
function it_implements_product_taxons_mapper_interface(): void
{
$this->shouldHaveType(ProductTaxonsMapperInterface::class);
}
function it_maps_to_unique_codes(
ProductInterface $product,
Collection $collection,
TaxonInterface $taxon
): void {
$taxon->getCode()->willReturn('book');
$taxons = new \ArrayIterator([$taxon]);
$collection->getIterator()->willReturn($taxons);
$product->getTaxons()->willReturn($collection);
$this->mapToUniqueCodes($product);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/Exception/TaxonNotFoundExceptionSpec.php | spec/Exception/TaxonNotFoundExceptionSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\Exception;
use BitBag\SyliusElasticsearchPlugin\Exception\TaxonNotFoundException;
use PhpSpec\ObjectBehavior;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
final class TaxonNotFoundExceptionSpec extends ObjectBehavior
{
function it_is_initializable(): void
{
$this->shouldHaveType(TaxonNotFoundException::class);
}
function it_is_an_not_found_exception(): void
{
$this->shouldHaveType(NotFoundHttpException::class);
}
function it_has_custom_message(): void
{
$this->getMessage()->shouldReturn('Taxon has not been found!');
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/QueryBuilder/HasTaxonQueryBuilderSpec.php | spec/QueryBuilder/HasTaxonQueryBuilderSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\QueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\HasTaxonQueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
use Elastica\Query\Terms;
use PhpSpec\ObjectBehavior;
final class HasTaxonQueryBuilderSpec extends ObjectBehavior
{
function let(): void
{
$this->beConstructedWith('taxons_property');
}
function it_is_initializable(): void
{
$this->shouldHaveType(HasTaxonQueryBuilder::class);
}
function it_implements_query_builder_interface(): void
{
$this->shouldHaveType(QueryBuilderInterface::class);
}
function it_builds_query(): void
{
$this->buildQuery([
'taxons_property' => 'book',
])->shouldBeAnInstanceOf(Terms::class);
}
function it_builds_returned_null_if_property_is_null(): void
{
$this->buildQuery(['taxons_property' => null])->shouldBeEqualTo(null);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/QueryBuilder/HasOptionsQueryBuilderSpec.php | spec/QueryBuilder/HasOptionsQueryBuilderSpec.php | <?php
/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.shop and write us
* an email on mikolaj.krol@bitbag.pl.
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\QueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\HasOptionsQueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
use Elastica\Query\BoolQuery;
use PhpSpec\ObjectBehavior;
final class HasOptionsQueryBuilderSpec extends ObjectBehavior
{
function it_is_initializable(): void
{
$this->shouldHaveType(HasOptionsQueryBuilder::class);
}
function it_implements_query_builder_interface(): void
{
$this->shouldHaveType(QueryBuilderInterface::class);
}
function it_builds_query(): void
{
$this->buildQuery([
'option_values' => ['XL', 'L'],
'option' => 'size',
])->shouldBeAnInstanceOf(BoolQuery::class);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/QueryBuilder/ProductOptionsByTaxonQueryBuilderSpec.php | spec/QueryBuilder/ProductOptionsByTaxonQueryBuilderSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\QueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\ProductOptionsByTaxonQueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
use Elastica\Query\AbstractQuery;
use Elastica\Query\BoolQuery;
use PhpSpec\ObjectBehavior;
final class ProductOptionsByTaxonQueryBuilderSpec extends ObjectBehavior
{
function let(QueryBuilderInterface $hasTaxonQueryBuilder): void
{
$this->beConstructedWith($hasTaxonQueryBuilder);
}
function it_is_initializable(): void
{
$this->shouldHaveType(ProductOptionsByTaxonQueryBuilder::class);
}
function it_implements_query_builder_interface(): void
{
$this->shouldHaveType(QueryBuilderInterface::class);
}
function it_builds_query(
QueryBuilderInterface $hasTaxonQueryBuilder,
AbstractQuery $taxonQuery
): void {
$hasTaxonQueryBuilder->buildQuery([])->willReturn($taxonQuery);
$this->buildQuery([])->shouldBeAnInstanceOf(BoolQuery::class);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/QueryBuilder/ContainsNameQueryBuilderSpec.php | spec/QueryBuilder/ContainsNameQueryBuilderSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\QueryBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyNameResolver\ConcatedNameResolverInterface;
use BitBag\SyliusElasticsearchPlugin\PropertyNameResolver\SearchPropertyNameResolverRegistryInterface;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\ContainsNameQueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
use Elastica\Query\MultiMatch;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Locale\Context\LocaleContextInterface;
final class ContainsNameQueryBuilderSpec extends ObjectBehavior
{
function let(
LocaleContextInterface $localeContext,
SearchPropertyNameResolverRegistryInterface $searchPropertyNameResolverRegistry,
ConcatedNameResolverInterface $productNameNameResolver
): void {
$this->beConstructedWith(
$localeContext,
$searchPropertyNameResolverRegistry,
'AUTO'
);
$searchPropertyNameResolverRegistry->getPropertyNameResolvers()->willReturn([$productNameNameResolver]);
}
function it_is_initializable(): void
{
$this->shouldHaveType(ContainsNameQueryBuilder::class);
}
function it_implements_query_builder_interface(): void
{
$this->shouldHaveType(QueryBuilderInterface::class);
}
function it_builds_query(
LocaleContextInterface $localeContext,
SearchPropertyNameResolverRegistryInterface $searchPropertyNameResolverRegistry,
ConcatedNameResolverInterface $productNameNameResolver
): void {
$localeContext->getLocaleCode()->willReturn('en');
$productNameNameResolver->resolvePropertyName('en')->willReturn('name_en');
$searchPropertyNameResolverRegistry->getPropertyNameResolvers()->willReturn([$productNameNameResolver]);
$query = $this->buildQuery(['name' => 'Book']);
$query->shouldBeAnInstanceOf(MultiMatch::class);
}
function it_returns_null_when_no_query(
LocaleContextInterface $localeContext,
SearchPropertyNameResolverRegistryInterface $searchPropertyNameResolverRegistry,
ConcatedNameResolverInterface $productNameNameResolver
): void {
$localeContext->getLocaleCode()->willReturn('en');
$productNameNameResolver->resolvePropertyName('en')->willReturn('name_en');
$searchPropertyNameResolverRegistry->getPropertyNameResolvers()->willReturn([$productNameNameResolver]);
$this->buildQuery([])->shouldReturn(null);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/QueryBuilder/HasChannelQueryBuilderSpec.php | spec/QueryBuilder/HasChannelQueryBuilderSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\QueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\HasChannelQueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
use Elastica\Query\Terms;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Channel\Context\ChannelContextInterface;
use Sylius\Component\Core\Model\ChannelInterface;
final class HasChannelQueryBuilderSpec extends ObjectBehavior
{
function let(ChannelContextInterface $channelContext): void
{
$this->beConstructedWith($channelContext, 'channel_property');
}
function it_is_initializable(): void
{
$this->shouldHaveType(HasChannelQueryBuilder::class);
}
function it_implements_query_builder_interface(): void
{
$this->shouldHaveType(QueryBuilderInterface::class);
}
function it_builds_query(
ChannelContextInterface $channelContext,
ChannelInterface $channel
): void {
$channel->getCode()->willReturn('web');
$channelContext->getChannel()->willReturn($channel);
$this->buildQuery([])->shouldBeAnInstanceOf(Terms::class);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/QueryBuilder/ProductsByPartialNameQueryBuilderSpec.php | spec/QueryBuilder/ProductsByPartialNameQueryBuilderSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\QueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
use Elastica\Query\AbstractQuery;
use Elastica\Query\BoolQuery;
use PhpSpec\ObjectBehavior;
final class ProductsByPartialNameQueryBuilderSpec extends ObjectBehavior
{
function let(QueryBuilderInterface $containsNameQueryBuilder): void
{
$this->beConstructedWith($containsNameQueryBuilder);
}
function it_is_a_query_builder(): void
{
$this->shouldImplement(QueryBuilderInterface::class);
}
function it_builds_query(
QueryBuilderInterface $containsNameQueryBuilder,
AbstractQuery $productsQuery
): void {
$containsNameQueryBuilder->buildQuery([])->willReturn($productsQuery);
$this->buildQuery([])->shouldBeAnInstanceOf(BoolQuery::class);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/QueryBuilder/HasPriceBetweenQueryBuilderSpec.php | spec/QueryBuilder/HasPriceBetweenQueryBuilderSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\QueryBuilder;
use BitBag\SyliusElasticsearchPlugin\PropertyNameResolver\ConcatedNameResolverInterface;
use BitBag\SyliusElasticsearchPlugin\PropertyNameResolver\PriceNameResolverInterface;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\HasPriceBetweenQueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
use Elastica\Query\Range;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Channel\Context\ChannelContextInterface;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Currency\Context\CurrencyContextInterface;
use Sylius\Component\Currency\Converter\CurrencyConverterInterface;
use Sylius\Component\Currency\Model\CurrencyInterface;
final class HasPriceBetweenQueryBuilderSpec extends ObjectBehavior
{
function let(
PriceNameResolverInterface $priceNameResolver,
ConcatedNameResolverInterface $channelPricingNameResolver,
ChannelContextInterface $channelContext,
CurrencyContextInterface $currencyContext,
CurrencyConverterInterface $currencyConverter
): void {
$this->beConstructedWith(
$priceNameResolver,
$channelPricingNameResolver,
$channelContext,
$currencyContext,
$currencyConverter
);
}
function it_is_initializable(): void
{
$this->shouldHaveType(HasPriceBetweenQueryBuilder::class);
}
function it_implements_query_builder_interface(): void
{
$this->shouldHaveType(QueryBuilderInterface::class);
}
function it_builds_query(
PriceNameResolverInterface $priceNameResolver,
ChannelContextInterface $channelContext,
ChannelInterface $channel,
CurrencyContextInterface $currencyContext,
CurrencyInterface $currency,
ConcatedNameResolverInterface $channelPricingNameResolver
): void {
$channel->getCode()->willReturn('web');
$channelContext->getChannel()->willReturn($channel);
$priceNameResolver->resolveMinPriceName()->willReturn('min_price');
$priceNameResolver->resolveMaxPriceName()->willReturn('max_price');
$channel->getBaseCurrency()->willReturn($currency);
$currency->getCode()->willReturn('USD');
$currencyContext->getCurrencyCode()->willReturn('USD');
$channelPricingNameResolver->resolvePropertyName('web')->willReturn('web');
$this->buildQuery([
'min_price' => '200',
'max_price' => '1000',
])->shouldBeAnInstanceOf(Range::class);
}
function it_converts_fractional_currency_properly(
PriceNameResolverInterface $priceNameResolver,
ChannelContextInterface $channelContext,
ChannelInterface $channel,
CurrencyContextInterface $currencyContext,
CurrencyInterface $currency,
ConcatedNameResolverInterface $channelPricingNameResolver
): void {
$channel->getCode()->willReturn('web');
$channelContext->getChannel()->willReturn($channel);
$priceNameResolver->resolveMinPriceName()->willReturn('min_price');
$priceNameResolver->resolveMaxPriceName()->willReturn('max_price');
$channel->getBaseCurrency()->willReturn($currency);
$currency->getCode()->willReturn('USD');
$currencyContext->getCurrencyCode()->willReturn('USD');
$channelPricingNameResolver->resolvePropertyName('web')->willReturn('web');
$range = $this->buildQuery([
'min_price' => '1,23',
'max_price' => '1000,51',
]);
$range->getParam('web')->shouldReturn(
[
'gte' => 123,
'lte' => 100051,
]
);
}
function it_build_query_with_max_price(
PriceNameResolverInterface $priceNameResolver,
ChannelContextInterface $channelContext,
ChannelInterface $channel,
CurrencyContextInterface $currencyContext,
CurrencyInterface $currency,
ConcatedNameResolverInterface $channelPricingNameResolver
): void {
$channel->getCode()->willReturn('web');
$channelContext->getChannel()->willReturn($channel);
$priceNameResolver->resolveMinPriceName()->willReturn('min_price');
$priceNameResolver->resolveMaxPriceName()->willReturn('max_price');
$channel->getBaseCurrency()->willReturn($currency);
$currency->getCode()->willReturn('USD');
$currencyContext->getCurrencyCode()->willReturn('USD');
$channelPricingNameResolver->resolvePropertyName('web')->willReturn('web');
$range = $this->buildQuery([
'max_price' => '110,51',
]);
$range->getParam('web')->shouldReturn(
[
'lte' => 11051,
]
);
}
function it_build_query_with_min_price(
PriceNameResolverInterface $priceNameResolver,
ChannelContextInterface $channelContext,
ChannelInterface $channel,
CurrencyContextInterface $currencyContext,
CurrencyInterface $currency,
ConcatedNameResolverInterface $channelPricingNameResolver
): void {
$channel->getCode()->willReturn('web');
$channelContext->getChannel()->willReturn($channel);
$priceNameResolver->resolveMinPriceName()->willReturn('min_price');
$priceNameResolver->resolveMaxPriceName()->willReturn('max_price');
$channel->getBaseCurrency()->willReturn($currency);
$currency->getCode()->willReturn('USD');
$currencyContext->getCurrencyCode()->willReturn('USD');
$channelPricingNameResolver->resolvePropertyName('web')->willReturn('web');
$range = $this->buildQuery([
'min_price' => '133,22',
]);
$range->getParam('web')->shouldReturn(
[
'gte' => 13322,
]
);
}
function it_build_query_without_price_param(
PriceNameResolverInterface $priceNameResolver,
ChannelContextInterface $channelContext,
ChannelInterface $channel,
CurrencyContextInterface $currencyContext,
CurrencyInterface $currency,
ConcatedNameResolverInterface $channelPricingNameResolver
): void {
$channel->getCode()->willReturn('web');
$channelContext->getChannel()->willReturn($channel);
$priceNameResolver->resolveMinPriceName()->willReturn('min_price');
$priceNameResolver->resolveMaxPriceName()->willReturn('max_price');
$channel->getBaseCurrency()->willReturn($currency);
$currency->getCode()->willReturn('USD');
$currencyContext->getCurrencyCode()->willReturn('USD');
$channelPricingNameResolver->resolvePropertyName('web')->willReturn('web');
$range = $this->buildQuery([]);
$range->shouldBeNull();
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/QueryBuilder/TaxonProductsQueryBuilderSpec.php | spec/QueryBuilder/TaxonProductsQueryBuilderSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\QueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\TaxonProductsQueryBuilder;
use Elastica\Query\AbstractQuery;
use Elastica\Query\BoolQuery;
use PhpSpec\ObjectBehavior;
final class TaxonProductsQueryBuilderSpec extends ObjectBehavior
{
function let(
QueryBuilderInterface $isEnabledQueryBuilder,
QueryBuilderInterface $hasChannelQueryBuilder,
QueryBuilderInterface $containsNameQueryBuilder,
QueryBuilderInterface $hasTaxonQueryBuilder,
QueryBuilderInterface $hasOptionsQueryBuilder,
QueryBuilderInterface $hasAttributesQueryBuilder,
QueryBuilderInterface $hasPriceBetweenQueryBuilder
): void {
$this->beConstructedWith(
$isEnabledQueryBuilder,
$hasChannelQueryBuilder,
$containsNameQueryBuilder,
$hasTaxonQueryBuilder,
$hasOptionsQueryBuilder,
$hasAttributesQueryBuilder,
$hasPriceBetweenQueryBuilder,
'option',
'attribute'
);
}
function it_is_initializable(): void
{
$this->shouldHaveType(TaxonProductsQueryBuilder::class);
}
function it_implements_query_builder_interface(): void
{
$this->shouldHaveType(QueryBuilderInterface::class);
}
function it_builds_query(
QueryBuilderInterface $isEnabledQueryBuilder,
QueryBuilderInterface $hasChannelQueryBuilder,
QueryBuilderInterface $containsNameQueryBuilder,
QueryBuilderInterface $hasTaxonQueryBuilder,
QueryBuilderInterface $hasOptionsQueryBuilder,
QueryBuilderInterface $hasAttributesQueryBuilder,
QueryBuilderInterface $hasPriceBetweenQueryBuilder,
AbstractQuery $query
): void {
$containsNameQueryBuilder->buildQuery(['option' => ['XL'], 'attribute' => ['Red']])->willReturn($query);
$isEnabledQueryBuilder->buildQuery(['option' => ['XL'], 'attribute' => ['Red']])->willReturn($query);
$hasTaxonQueryBuilder->buildQuery(['option' => ['XL'], 'attribute' => ['Red']])->willReturn($query);
$hasChannelQueryBuilder->buildQuery(['option' => ['XL'], 'attribute' => ['Red']])->willReturn($query);
$hasOptionsQueryBuilder->buildQuery(['option' => 'option', 'option_values' => ['XL']])->willReturn($query);
$hasAttributesQueryBuilder->buildQuery(['attribute' => 'attribute', 'attribute_values' => ['Red']])->willReturn($query);
$hasPriceBetweenQueryBuilder->buildQuery(['option' => ['XL'], 'attribute' => ['Red']])->willReturn($query);
$this->buildQuery([
'option' => ['XL'],
'attribute' => ['Red'],
])->shouldBeAnInstanceOf(BoolQuery::class);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/QueryBuilder/SiteWideProductsQueryBuilderSpec.php | spec/QueryBuilder/SiteWideProductsQueryBuilderSpec.php | <?php
/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\QueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\SiteWideProductsQueryBuilder;
use Elastica\Query\AbstractQuery;
use Elastica\Query\BoolQuery;
use Elastica\Query\MultiMatch;
use Elastica\Query\Term;
use Elastica\Query\Terms;
use PhpSpec\ObjectBehavior;
final class SiteWideProductsQueryBuilderSpec extends ObjectBehavior
{
private AbstractQuery $isEnabeldQuery;
private AbstractQuery $hasChannelQuery;
private AbstractQuery $containsNameQuery;
function let(
QueryBuilderInterface $isEnabledQueryBuilder,
QueryBuilderInterface $hasChannelQueryBuilder,
QueryBuilderInterface $containsNameQueryBuilder,
): void {
$this->isEnabeldQuery = new Term();
$this->isEnabeldQuery->setTerm('enabled', true);
$isEnabledQueryBuilder->buildQuery([])->willReturn($this->isEnabeldQuery);
$this->hasChannelQuery = new Terms('channels');
$this->hasChannelQuery->setTerms(['web_us']);
$hasChannelQueryBuilder->buildQuery([])->willReturn($this->hasChannelQuery);
$this->containsNameQuery = new MultiMatch();
$this->containsNameQuery->setQuery('bmw');
$containsNameQueryBuilder->buildQuery(['query' => 'bmw'])->willReturn($this->containsNameQuery);
$this->beConstructedWith(
$isEnabledQueryBuilder,
$hasChannelQueryBuilder,
$containsNameQueryBuilder
);
}
function it_is_initializable(): void
{
$this->shouldHaveType(SiteWideProductsQueryBuilder::class);
}
function it_implements_query_builder_interface(): void
{
$this->shouldHaveType(QueryBuilderInterface::class);
}
function it_builds_multi_match_query_with_provided_query_string(): void
{
$expectedQuery = new BoolQuery();
$expectedQuery->addMust($this->isEnabeldQuery);
$expectedQuery->addMust($this->hasChannelQuery);
$expectedQuery->addMust($this->containsNameQuery);
$this->buildQuery(['query' => 'bmw'])->shouldBeLike($expectedQuery);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/QueryBuilder/IsEnabledQueryBuilderSpec.php | spec/QueryBuilder/IsEnabledQueryBuilderSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\QueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\IsEnabledQueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
use Elastica\Query\Term;
use PhpSpec\ObjectBehavior;
final class IsEnabledQueryBuilderSpec extends ObjectBehavior
{
function let(): void
{
$this->beConstructedWith('enabled');
}
function it_is_initializable(): void
{
$this->shouldHaveType(IsEnabledQueryBuilder::class);
}
function it_implements_query_builder_interface(): void
{
$this->shouldHaveType(QueryBuilderInterface::class);
}
function it_builds_query(): void
{
$this->buildQuery([])->shouldBeAnInstanceOf(Term::class);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/QueryBuilder/HasAttributesQueryBuilderSpec.php | spec/QueryBuilder/HasAttributesQueryBuilderSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\QueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\AttributesQueryBuilder\AttributesTypeTextQueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\HasAttributesQueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
use BitBag\SyliusElasticsearchPlugin\Repository\ProductAttributeRepository;
use Elastica\Query\BoolQuery;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Locale\Context\LocaleContextInterface;
final class HasAttributesQueryBuilderSpec extends ObjectBehavior
{
private iterable $attributeDriver;
function let(
LocaleContextInterface $localeContext,
ProductAttributeRepository $productAttributeRepository,
AttributesTypeTextQueryBuilder $attributesTypeTextQueryBuilder
): void {
$this->attributeDriver = new \ArrayIterator([$attributesTypeTextQueryBuilder->getWrappedObject()]);
$this->beConstructedWith($localeContext, $productAttributeRepository, $this->attributeDriver);
}
function it_is_initializable(): void
{
$this->shouldHaveType(HasAttributesQueryBuilder::class);
}
function it_implements_query_builder_interface(): void
{
$this->shouldHaveType(QueryBuilderInterface::class);
}
function it_builds_query(
LocaleContextInterface $localeContext,
ProductAttributeRepository $productAttributeRepository,
AttributesTypeTextQueryBuilder $attributesTypeTextQueryBuilder,
BoolQuery $boolQuery
): void {
$attributeName = 'Size';
$data = [
'attribute_values' => ['XL', 'L'],
'attribute' => $attributeName,
];
$queryAttributeName = str_replace('attribute_', '', $data['attribute']);
$productAttributeRepository->getAttributeTypeByName($queryAttributeName)
->willReturn('select');
$attributesTypeTextQueryBuilder->supports('select')
->willReturn(true);
$localeContext->getLocaleCode()->willReturn('en');
$attributesTypeTextQueryBuilder->buildQuery($data, 'en')
->willReturn($boolQuery);
$this->buildQuery($data)
->shouldBeAnInstanceOf(BoolQuery::class);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
BitBagCommerce/SyliusElasticsearchPlugin | https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/12afd251bd3a3f7cf280cbb43166a94e89eac291/spec/QueryBuilder/ProductAttributesByTaxonQueryBuilderSpec.php | spec/QueryBuilder/ProductAttributesByTaxonQueryBuilderSpec.php | <?php
/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
declare(strict_types=1);
namespace spec\BitBag\SyliusElasticsearchPlugin\QueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\ProductAttributesByTaxonQueryBuilder;
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
use Elastica\Query\AbstractQuery;
use Elastica\Query\BoolQuery;
use PhpSpec\ObjectBehavior;
final class ProductAttributesByTaxonQueryBuilderSpec extends ObjectBehavior
{
function let(QueryBuilderInterface $hasTaxonQueryBuilder): void
{
$this->beConstructedWith($hasTaxonQueryBuilder);
}
function it_is_initializable(): void
{
$this->shouldHaveType(ProductAttributesByTaxonQueryBuilder::class);
}
function it_implements_query_builder_interface(): void
{
$this->shouldHaveType(QueryBuilderInterface::class);
}
function it_builds_query(
QueryBuilderInterface $hasTaxonQueryBuilder,
AbstractQuery $taxonQuery
): void {
$hasTaxonQueryBuilder->buildQuery([])->willReturn($taxonQuery);
$this->buildQuery([])->shouldBeAnInstanceOf(BoolQuery::class);
}
}
| php | MIT | 12afd251bd3a3f7cf280cbb43166a94e89eac291 | 2026-01-05T05:15:43.159589Z | false |
reactphp-legacy/gifsocket | https://github.com/reactphp-legacy/gifsocket/blob/e8597f4a17c4a72bf5d3ee56db82ca7ca8a4174a/src/React/Gifsocket/Server.php | src/React/Gifsocket/Server.php | <?php
namespace React\Gifsocket;
use React\Curry\Util as Curry;
use React\EventLoop\LoopInterface;
class Server
{
private $gifStreams;
private $loop;
public function __construct(LoopInterface $loop)
{
$this->gifStreams = new \SplObjectStorage();
$this->loop = $loop;
}
// Add the frame twice because some browsers (safari, opera)
// would start lagging behind otherwise
// add timeout so that first frame can flush
public function addFrame($frame)
{
foreach ($this->gifStreams as $gif) {
$gif->addFrame($frame);
$gif->lastFrame = $frame;
$this->loop->addTimer(0.001, Curry::bind([$this, 'resendFrame'], $gif, $frame));
}
}
public function __invoke($request, $response)
{
$response->writeHead(200, [
'Content-Type' => 'image/gif',
'Cache-Control' => 'no-cache, no-store',
'Pragma' => 'no-cache',
]);
$gif = $this->createGifStream();
$gif->pipe($response);
$this->gifStreams->attach($gif);
$response->on('close', function () use ($gif) {
$this->gifStreams->detach($gif);
$gif->close();
});
}
public function resendFrame(GifStream $gif, $frame)
{
if ($gif->lastFrame !== $frame) {
return;
}
$gif->addFrame($frame);
}
private function createGifStream()
{
$encoder = new GifEncoder();
$gif = new GifStream($encoder);
return $gif;
}
}
| php | MIT | e8597f4a17c4a72bf5d3ee56db82ca7ca8a4174a | 2026-01-05T05:15:49.929003Z | false |
reactphp-legacy/gifsocket | https://github.com/reactphp-legacy/gifsocket/blob/e8597f4a17c4a72bf5d3ee56db82ca7ca8a4174a/src/React/Gifsocket/GifStream.php | src/React/Gifsocket/GifStream.php | <?php
namespace React\Gifsocket;
use Evenement\EventEmitter;
use React\Stream\ReadableStreamInterface;
use React\Stream\WritableStreamInterface;
use React\Stream\Util;
class GifStream extends EventEmitter implements ReadableStreamInterface
{
private $encoder;
private $closed = false;
public function __construct(GifEncoder $encoder)
{
$this->encoder = $encoder;
}
public function addFrame($frame, $delay = 0)
{
$data = $this->encoder->addFrame($frame, $delay);
$this->emit('data', [$data]);
}
public function isReadable()
{
return !$this->closed;
}
public function pause()
{
}
public function resume()
{
}
public function close()
{
if ($this->closed) {
return;
}
$data = $this->encoder->finish();
$this->emit('data', [$data]);
$this->closed = true;
$this->emit('close');
$this->removeAllListeners();
}
public function pipe(WritableStreamInterface $dest, array $options = [])
{
Util::pipe($this, $dest, $options);
return $dest;
}
}
| php | MIT | e8597f4a17c4a72bf5d3ee56db82ca7ca8a4174a | 2026-01-05T05:15:49.929003Z | false |
reactphp-legacy/gifsocket | https://github.com/reactphp-legacy/gifsocket/blob/e8597f4a17c4a72bf5d3ee56db82ca7ca8a4174a/src/React/Gifsocket/Router.php | src/React/Gifsocket/Router.php | <?php
namespace React\Gifsocket;
class Router
{
private $routes;
public function __construct(array $routes)
{
$this->routes = $routes;
}
public function __invoke($request, $response)
{
foreach ($this->routes as $pattern => $controller) {
if ($this->requestMatchesPattern($request, $pattern)) {
$controller($request, $response);
return;
}
}
$this->handleNotFound($request, $response);
}
protected function requestMatchesPattern($request, $pattern)
{
return $pattern === $request->getPath();
}
protected function handleNotFound($request, $response)
{
$response->writeHead(404, ['Content-Type' => 'text/plain']);
$response->end("We are sorry to inform you that the requested resource does not exist.");
}
}
| php | MIT | e8597f4a17c4a72bf5d3ee56db82ca7ca8a4174a | 2026-01-05T05:15:49.929003Z | false |
reactphp-legacy/gifsocket | https://github.com/reactphp-legacy/gifsocket/blob/e8597f4a17c4a72bf5d3ee56db82ca7ca8a4174a/examples/chat.php | examples/chat.php | <?php
require __DIR__.'/../vendor/autoload.php';
function createGifFrame(array $messages)
{
$im = imagecreatetruecolor(500, 400);
imagefilledrectangle($im, 0, 0, 500, 400, 0x000000);
foreach ($messages as $i => $message) {
imagestring($im, 3, 40, 20 + $i*20, $message, 0xFFFFFF);
}
ob_start();
imagegif($im);
imagedestroy($im);
return ob_get_clean();
}
function sendEmptyFrameAfter($gifServer)
{
return function ($request, $response) use ($gifServer) {
$gifServer($request, $response);
$gifServer->addFrame(createGifFrame(['']));
};
}
$loop = React\EventLoop\Factory::create();
$socket = new React\Socket\Server($loop);
$http = new React\Http\Server($socket);
$gifServer = new React\Gifsocket\Server($loop);
$messages = [];
$addMessage = function ($message) use ($gifServer, &$messages) {
$messages[] = $message;
if (count($messages) > 18) {
$messages = array_slice($messages, count($messages) - 18);
}
$frame = createGifFrame($messages);
$gifServer->addFrame($frame);
};
$router = new React\Gifsocket\Router([
'/socket.gif' => sendEmptyFrameAfter($gifServer),
'/' => function ($request, $response) use ($loop) {
$response->writeHead(200, ['Content-Type' => 'text/html']);
$fd = fopen(__DIR__.'/views/index.html', 'r');
$template = new React\Stream\Stream($fd, $loop);
$template->pipe($response);
},
'/message' => function ($request, $response) use ($addMessage) {
$message = $request->getQuery()['message'];
$addMessage($message);
$response->writeHead(200);
$response->end();
},
]);
$http->on('request', $router);
echo "Webserver running on localhost:8080\n";
$socket->listen(8080);
$loop->run();
| php | MIT | e8597f4a17c4a72bf5d3ee56db82ca7ca8a4174a | 2026-01-05T05:15:49.929003Z | false |
reactphp-legacy/gifsocket | https://github.com/reactphp-legacy/gifsocket/blob/e8597f4a17c4a72bf5d3ee56db82ca7ca8a4174a/examples/stdin.php | examples/stdin.php | <?php
require __DIR__.'/../vendor/autoload.php';
function createGifFrame(array $messages)
{
$im = imagecreatetruecolor(500, 400);
imagefilledrectangle($im, 0, 0, 500, 400, 0x000000);
foreach ($messages as $i => $message) {
imagestring($im, 3, 40, 20 + $i*20, $message, 0xFFFFFF);
}
ob_start();
imagegif($im);
imagedestroy($im);
return ob_get_clean();
}
function sendEmptyFrameAfter($gifServer)
{
return function ($request, $response) use ($gifServer) {
$gifServer($request, $response);
$gifServer->addFrame(createGifFrame(['']));
};
}
$loop = React\EventLoop\Factory::create();
$socket = new React\Socket\Server($loop);
$http = new React\Http\Server($socket);
$gifServer = new React\Gifsocket\Server($loop);
$messages = [];
$addMessage = function ($message) use ($gifServer, &$messages) {
$messages[] = $message;
if (count($messages) > 18) {
$messages = array_slice($messages, count($messages) - 18);
}
$frame = createGifFrame($messages);
$gifServer->addFrame($frame);
};
$stdin = new React\Stream\Stream(STDIN, $loop);
$stdin->on('data', function ($data) use ($addMessage) {
$messages = explode("\n", trim($data));
foreach ($messages as $message) {
$addMessage($message);
}
});
$router = new React\Gifsocket\Router([
'/' => sendEmptyFrameAfter($gifServer),
]);
$http->on('request', $router);
echo "Webserver running on localhost:8080\n";
$socket->listen(8080);
$loop->run();
| php | MIT | e8597f4a17c4a72bf5d3ee56db82ca7ca8a4174a | 2026-01-05T05:15:49.929003Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/client-backend/index.php | client-backend/index.php | <?php
// SE DEFINEN LOS HEADERS
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, Authorization');
header('Content-Type: application/json');
class Api
{
// Configuracion de cliente
protected $apiUrl = 'http://localhost:8000/api';
protected $clientDomain = 'localhost'; // Sin http o https
protected $domainPath = '/';
protected $useHttps = false;
protected $sessionCookieName = 'Laqul';
protected $clientId = '71d4f8ea-1138-11e8-a472-002163944a0x';
protected $clientSecret = 'y1d4f8ea113811e8a472002163944a0x1234';
/*********************************************************/
// Parametros de la clase
protected $requestMethod;
protected $apiCommand;
protected $requestData;
// Inicializacion de clase
public function __construct()
{
header('Access-Control-Allow-Origin: ' . (($this->useHttps) ? 'https://' : 'http://') . $this->clientDomain);
$this->requestMethod = filter_input(INPUT_SERVER, 'REQUEST_METHOD');
$this->process();
}
// Procesa la solicitud
private function process()
{
// Primero valida que exista el comando en la solicitud
if (!filter_has_var(INPUT_GET, 'command')) {
$this->makeResponse(['error' => 'Missing command'], 400);
}
// Se obtiene el comando
$this->apiCommand = filter_input(INPUT_GET, 'command');
// En todas las operaciones de escritura se revisa el XSRF-TOKEN
if (in_array($this->requestMethod, ['POST','PUT','PATCH','DELETE'])) {
$this->csrf();
// Se obtienen los parametros de la peticion
$this->requestData = $this->jsonData();
}
// el proceso pasa al metodo runCommand
return $this->runCommand();
}
// Ejecuta un comando
private function runCommand()
{
switch ($this->apiCommand) {
case 'xsrf':
$this->xsrf();
break;
case 'emailVerification':
$this->emailVerification();
break;
case 'registration':
$this->registration();
break;
case 'login':
$this->login();
break;
case 'loginFacebook':
$this->socialLink('facebook');
break;
case 'loginGoogle':
$this->socialLink('google');
break;
case 'socialLogin':
$this->socialLogin();
break;
case 'forgotPassword':
$this->forgotPassword();
break;
case 'resetPassword':
$this->resetPassword();
break;
case 'logout':
$this->logout();
break;
case 'refreshTokens':
$this->refreshTokens();
break;
default:
$this->makeResponse(['error' => 'Bad command'], 400);
break;
}
}
// Retorna una respuesta al cliente
private function makeResponse($data, $status_code)
{
if (is_object($data)) {
$data->backend = true;
} else {
$data['backend'] = true;
}
http_response_code($status_code);
setcookie('XSRF-TOKEN', $this->generateRandomString(150), time() + (120*60), $this->domainPath, $this->clientDomain, $this->useHttps, false);
print(json_encode($data));
exit();
}
// Genera cadenas de texto al azar
private function generateRandomString($length = 10)
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
// Se verifica la cookie XSRF-TOKEN
private function csrf()
{
$headers = getallheaders();
if (!isset($headers['x-xsrf-token'])) {
$this->makeResponse(['error' => 'X-XSRF-TOKEN header not exists'], 400);
}
if ($headers['x-xsrf-token'] != filter_input(INPUT_COOKIE, 'XSRF-TOKEN')) {
$this->makeResponse(['error' => 'XSRF-TOKEN mismatch'], 400);
}
}
//OBTIENE LOS DATOS DE LA SOLICITUD
private function jsonData()
{
$data = $this->isValidJSON(file_get_contents('php://input'));
return $data;
}
// VALIDA QUE SEA UNA CADENA JSON VALIDA
private function isValidJSON($str)
{
if ($str == null) {
return null;
}
$data = json_decode($str);
if (json_last_error() != JSON_ERROR_NONE) {
$this->makeResponse(['error' => 'Json invalid format'], 400);
}
return $data;
}
// Realiza una pericion http a la api
private function httpRequest($path, $method, $body = false)
{
$headers = ['X-Requested-With: XMLHttpRequest', 'Content-Type: application/json', 'Accept: application/json'];
$ch = curl_init($this->apiUrl . $path);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
if ($body) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
$headers[] = 'Content-Length: ' . strlen($body);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
$this->makeResponse(['error' => curl_error($ch)], $status ?: 500);
}
curl_close($ch);
$data = $this->isValidJSON($response);
return ['status' => $status, 'response' => $data, 'json' => $response];
}
// SE ELIMINA LA COOKIE DE SESION
private function deleteCookie()
{
if (isset($_COOKIE[$this->sessionCookieName])) {
unset($_COOKIE[$this->sessionCookieName]);
setcookie($this->sessionCookieName, '', time() - 3600, $this->domainPath, $this->clientDomain, $this->useHttps, true);
}
}
/***********************COMANDOS **************************/
/**********************************************************/
// Inicializa la cookie xsrf
private function xsrf()
{
$this->makeResponse(['success' => true], 200);
}
// Obtiene un codigo de verificacion de email para proceder con el registro del usuario
private function emailVerification()
{
if (!isset($this->requestData->email)) {
$this->makeResponse(['error' => 'Missing params'], 400);
}
$json = json_encode([
'client_id' => $this->clientId,
'email' => $this->requestData->email
]);
$data = $this->httpRequest('/auth/verification', 'POST', $json);
if ($data['status'] == 200 && isset($data['response']->code)) {
$this->makeResponse(['success' => true], $data['status']);
}
$this->makeResponse($data['response'], $data['status']);
}
// Registro de usuarios
private function registration()
{
if (!isset($this->requestData->code) || !isset($this->requestData->name) || !isset($this->requestData->password) || !isset($this->requestData->password_confirmation) || !isset($this->requestData->timezone)) {
$this->makeResponse(['error' => 'Missing params'], 400);
}
$json = json_encode([
'client_id' => $this->clientId,
'code' => $this->requestData->code,
'name' => $this->requestData->name,
'password' => $this->requestData->password,
'password_confirmation' => $this->requestData->password_confirmation,
'timezone' => $this->requestData->timezone
]);
$data = $this->httpRequest('/auth/registration', 'POST', $json);
if ($data['status'] == 200 && isset($data['response']->name)) {
$this->makeResponse($data['response'], $data['status']);
}
$this->makeResponse($data['response'], $data['status']);
}
// Inicia el proceso de login
private function login()
{
if (!isset($this->requestData->username) || !isset($this->requestData->password)) {
$this->makeResponse(['error' => 'Missing params'], 400);
}
$json = json_encode([
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
'grant_type' => 'password',
'username' => $this->requestData->username,
'password' => $this->requestData->password
]);
$data = $this->httpRequest('/auth/token', 'POST', $json);
if ($data['status'] == 200 && isset($data['response']->access_token)) {
setcookie($this->sessionCookieName, $data['response']->refresh_token, time() + 15552000, $this->domainPath, $this->clientDomain, $this->useHttps, true);
$response = ['access_token' => $data['response']->access_token, 'expires_in' => $data['response']->expires_in];
if (isset($data['response']->firebase_token)) {
$response['firebase_access_token'] = $data['response']->firebase_token;
}
$this->makeResponse($response, $data['status']);
}
$this->makeResponse($data['response'], $data['status']);
}
// Obtiene el link de redireccion de la red social
private function socialLink($platform)
{
$data = $this->httpRequest('/auth/social/' . $platform, 'GET');
if ($data['status'] == 200 && isset($data['response']->redirect)) {
$this->makeResponse($data['response'], $data['status']);
}
$this->makeResponse($data['response'], $data['status']);
}
// Inicia el proceso de login social
private function socialLogin()
{
if (!isset($this->requestData->code) || !isset($this->requestData->platform) || !isset($this->requestData->timezone)) {
$this->makeResponse(['error' => 'Missing params'], 400);
}
$json = json_encode([
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
'code' => $this->requestData->code,
'timezone' => $this->requestData->timezone
]);
$data = $this->httpRequest('/auth/social/' . $this->requestData->platform, 'POST', $json);
if ($data['status'] == 200 && isset($data['response']->access_token)) {
setcookie($this->sessionCookieName, $data['response']->refresh_token, time() + 15552000, $this->domainPath, $this->clientDomain, $this->useHttps, true);
$response = ['access_token' => $data['response']->access_token, 'expires_in' => $data['response']->expires_in];
if (isset($data['response']->firebase_token)) {
$response['firebase_access_token'] = $data['response']->firebase_token;
}
$this->makeResponse($response, $data['status']);
}
$this->makeResponse($data['response'], $data['status']);
}
// Obtiene un token para restablecer la contrasena del usuario
private function forgotPassword()
{
if (!isset($this->requestData->email)) {
$this->makeResponse(['error' => 'Missing params'], 400);
}
$json = json_encode([
'client_id' => $this->clientId,
'email' => $this->requestData->email
]);
$data = $this->httpRequest('/auth/forgot', 'POST', $json);
if ($data['status'] == 200 && isset($data['response']->token)) {
$this->makeResponse(['success' => true], $data['status']);
}
$this->makeResponse($data['response'], $data['status']);
}
// Restablecimiento de password
private function resetPassword()
{
if (!isset($this->requestData->token) || !isset($this->requestData->password) || !isset($this->requestData->password_confirmation)) {
$this->makeResponse(['error' => 'Missing params'], 400);
}
$json = json_encode([
'client_id' => $this->clientId,
'token' => $this->requestData->token,
'password' => $this->requestData->password,
'password_confirmation' => $this->requestData->password_confirmation
]);
$data = $this->httpRequest('/auth/reset', 'PATCH', $json);
if ($data['status'] == 200 && isset($data['response']->success)) {
$this->makeResponse($data['response'], $data['status']);
}
$this->makeResponse($data['response'], $data['status']);
}
// Cierra la sesion del usuario
private function logout($data = ['success' => true], $status = 200)
{
$this->deleteCookie();
$this->makeResponse($data, $status);
}
// Inicia el proceso de renovacion de token
private function refreshTokens()
{
if (!isset($_COOKIE[$this->sessionCookieName])) {
$this->makeResponse(['error' => 'Session dont exists'], 401);
}
$json = json_encode([
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
'grant_type' => 'refresh_token',
'refresh_token' => filter_input(INPUT_COOKIE, $this->sessionCookieName)
]);
$data = $this->httpRequest('/auth/token', 'POST', $json);
if ($data['status'] == 200 && isset($data['response']->access_token)) {
setcookie($this->sessionCookieName, $data['response']->refresh_token, time() + 15552000, $this->domainPath, $this->clientDomain, $this->useHttps, true);
$response = ['access_token' => $data['response']->access_token, 'expires_in' => $data['response']->expires_in];
if (isset($data['response']->firebase_token)) {
$response['firebase_access_token'] = $data['response']->firebase_token;
}
$this->makeResponse($response, $data['status']);
}
$this->logout($data['response'], $data['status']);
}
}
$request = new Api;
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/server.php | api/server.php | <?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false;
}
require_once __DIR__.'/public/index.php';
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Exceptions/Handler.php | api/app/Exceptions/Handler.php | <?php
namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
* @return void
*/
public function report(Exception $exception)
{
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
{
return parent::render($request, $exception);
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Http/Kernel.php | api/app/Http/Kernel.php | <?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
\Barryvdh\Cors\HandleCors::class,
];
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:60,1',
'bindings',
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
];
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Http/Controllers/Controller.php | api/app/Http/Controllers/Controller.php | <?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Http/Controllers/Api/Traits/Notifications.php | api/app/Http/Controllers/Api/Traits/Notifications.php | <?php
namespace App\Http\Controllers\Api\Traits;
use App\Models\User\User;
use LaravelFCM\Message\OptionsBuilder;
use LaravelFCM\Message\PayloadDataBuilder;
use LaravelFCM\Message\PayloadNotificationBuilder;
use FCM;
use Carbon\Carbon;
use App\Models\User\MessagingToken;
use App\Models\User\Notification;
trait Notifications
{
private $retryTimes = 1;
public function notificate(User $user, $title, $body, $color = 'positive', $payload = [], $type = 'default', $hours = false, $save = false)
{
if ($hours) {
$hasNotification = $user->notifications->where('type', $type)->where('created_at', '>=', Carbon::now()->subHours($hours))->first();
if ($hasNotification) {
return true;
}
}
if ($save) {
Notification::create([
'user_id' => $user->id,
'type' => $type,
'color' => $color,
'title' => $title,
'body' => $body,
'payload' => $payload
]);
$payload['sincronize'] = true;
}
$devices = $user->messagingTokens->pluck('token')->toArray();
$notificationBuilder = new PayloadNotificationBuilder($title);
$notificationBuilder->setBody($body)->setSound('default')->setIcon('http://localhost:8080/img/logo.png');
$notification = $notificationBuilder->build();
$optionBuilder = new OptionsBuilder();
$optionBuilder->setTimeToLive(60*20);
$option = $optionBuilder->build();
$dataBuilder = new PayloadDataBuilder();
$dataBuilder->addData(['payload' => json_encode($payload)]);
$data = $dataBuilder->build();
$downstreamResponse = $this->send($devices, $option, $notification, $data);
$this->deleteTokens($downstreamResponse->tokensToDelete());
$this->deleteTokens(array_keys($downstreamResponse->tokensWithError()));
$this->updateTokens($downstreamResponse->tokensToModify());
$this->retry($downstreamResponse->tokensToRetry(), $option, $notification, $data);
return ['success' => $downstreamResponse->numberSuccess(), 'fail' => $downstreamResponse->numberFailure(), 'modify' => $downstreamResponse->numberModification(), 'retry' => count($downstreamResponse->tokensToRetry())];
}
private function send($devices, $option, $notification, $data)
{
return FCM::sendTo($devices, $option, $notification, $data);
}
private function deleteTokens($tokens)
{
if (!count($tokens)) {
return true;
}
MessagingToken::whereIn('token', $tokens)->delete();
}
private function updateTokens($tokens)
{
if (!count($tokens)) {
return true;
}
foreach ($tokens as $key => $value) {
$current = MessagingToken::where('token', $key)->first();
if ($current) {
$current->token = $value;
$current->save();
}
}
}
private function retry($devices, $options, $notification, $data)
{
if (count($devices) && $this->retryTimes > 0) {
$this->retryTimes--;
$this->send($devices, $option, $notification, $data);
}
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Http/Controllers/Api/Auth/Registration/VerificationController.php | api/app/Http/Controllers/Api/Auth/Registration/VerificationController.php | <?php
namespace App\Http\Controllers\Api\Auth\Registration;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Validation\Rule;
use App\Models\Auth\Registration\EmailVerification;
use App\Mail\EmailVerification as EmailVerificationCode;
use Illuminate\Support\Facades\Mail;
class VerificationController extends Controller
{
private function validateRequest(Request $request) {
$request->validate([
'client_id' => 'bail|required|string|exists:oauth_clients,id',
'email' => ['required','email',
Rule::unique('users')->where(function ($query) use ($request) {
return $query->where('client_id', $request->client_id);
})]
]);
}
public function generateCode(Request $request){
$this->validateRequest($request);
$code = substr(uniqid(str_random(87)), 0, 100);
EmailVerification::updateOrCreate(
['client_id' => $request->client_id, 'email' => $request->email],
['code' => $code]);
Mail::to($request->email)->send(new EmailVerificationCode($code));
return response()->json(['success' => true]);
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Http/Controllers/Api/Auth/Registration/RegistrationController.php | api/app/Http/Controllers/Api/Auth/Registration/RegistrationController.php | <?php
namespace App\Http\Controllers\Api\Auth\Registration;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Validator;
use Illuminate\Validation\Rule;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use App\Models\Auth\Registration\EmailVerification;
use App\Models\User\User;
class RegistrationController extends Controller
{
private function validateRequest(Request $request)
{
$request->validate([
'client_id' => 'bail|required|string|exists:oauth_clients,id',
'name' => 'bail|required|string|min:4|max:30',
'code' => ['bail', 'required', 'string', 'size:100',
Rule::exists('email_verifications')->where(function ($query) {
$query->where('updated_at', '>=', Carbon::now()->subMinutes(60));
})],
'password' => 'required|min:8|max:30|confirmed',
'timezone' => 'required|min:2|max:50|in:' . implode(',', \DateTimeZone::listIdentifiers())
]);
}
public function registration(Request $request)
{
$this->validateRequest($request);
$user = null;
DB::transaction(function () use ($request, &$user) {
$verification = EmailVerification::where('code', $request->code)->first();
$user = User::create([
'client_id' => $verification->client_id,
'name' => title_case($request->name),
'email' => $verification->email,
'password' => bcrypt($request->password),
'timezone' => $request->timezone
]);
$verification->delete();
});
return $user;
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Http/Controllers/Api/Auth/ResetPassword/ResetController.php | api/app/Http/Controllers/Api/Auth/ResetPassword/ResetController.php | <?php
namespace App\Http\Controllers\Api\Auth\ResetPassword;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Validator;
use Illuminate\Validation\Rule;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use App\Models\Auth\PasswordReset\PasswordReset;
use App\Models\User\User;
class ResetController extends Controller
{
private function validateRequest(Request $request)
{
$request->validate([
'client_id' => 'bail|required|string|exists:oauth_clients,id',
'token' => ['bail','required','string','size:150',
Rule::exists('password_resets')->where(function ($query) {
$query->where('updated_at', '>=', Carbon::now()->subMinutes(60));
})],
'password' => 'required|min:8|max:30|confirmed'
]);
}
public function resetPassword(Request $request)
{
$this->validateRequest($request);
DB::transaction(function () use ($request) {
$reset = PasswordReset::where('token', $request->token)->first();
$user = User::find($reset->user_id);
$reset->delete();
$user->password = bcrypt($request->password);
$user->save();
});
return response()->json(['success' => true]);
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Http/Controllers/Api/Auth/ResetPassword/ForgotController.php | api/app/Http/Controllers/Api/Auth/ResetPassword/ForgotController.php | <?php
namespace App\Http\Controllers\Api\Auth\ResetPassword;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Validation\Rule;
use Illuminate\Support\Facades\DB;
use App\Models\User\User;
use App\Models\Auth\PasswordReset\PasswordReset;
use App\Mail\ForgotPassword;
use Illuminate\Support\Facades\Mail;
class ForgotController extends Controller
{
private function validateRequest(Request $request) {
$request->validate([
'client_id' => 'bail|required|string|exists:oauth_clients,id',
'email' => ['bail','required',
Rule::exists('users')->where(function ($query) use ($request) {
$query->where('client_id', $request->client_id)
->where('active', true);
})]]);
}
public function generateToken(Request $request){
$this->validateRequest($request);
$token = substr(uniqid(str_random(137)), 0, 150);
DB::transaction(function () use ($request, $token) {
$user = User::where('client_id', $request->client_id)
->where('email', $request->email)
->where('active', true)->first();
PasswordReset::updateOrCreate([
'user_id' => $user->id],
['token' => $token]);
});
Mail::to($request->email)->send(new ForgotPassword($token));
return response()->json(['success' => true]);
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Http/Controllers/Api/Auth/Login/CustomAccessTokenController.php | api/app/Http/Controllers/Api/Auth/Login/CustomAccessTokenController.php | <?php
namespace App\Http\Controllers\Api\Auth\Login;
use Psr\Http\Message\ServerRequestInterface;
use Laravel\Passport\Http\Controllers\AccessTokenController;
use Firebase\JWT\JWT;
use Laravel\Passport\Passport;
class CustomAccessTokenController extends AccessTokenController
{
/**
* Hooks in before the AccessTokenController issues a token
*
*
* @param ServerRequestInterface $request
* @return mixed
*/
public function issueUserToken(ServerRequestInterface $request)
{
$result = $this->issueToken($request);
$content = json_decode($result->content(), true);
$httpRequest = request();
if (config('auth.firebaseToken.generate') && json_last_error() == JSON_ERROR_NONE && isset($content['access_token']) && ($httpRequest->grant_type == 'password' || $httpRequest->grant_type == 'refresh_token')) {
$token = $this->firebaseToken($content);
$result->setContent(array_merge($content, ['firebase_token' => $token]));
}
return $result;
}
private function getKeys()
{
list($publicKey, $privateKey) = [
Passport::keyPath('oauth-public.key'),
Passport::keyPath('firebase-private.key'),
];
return ['public' => file_get_contents($publicKey), 'private' => file_get_contents($privateKey)];
}
private function firebaseToken($content)
{
$keys = $this->getKeys();
$decoded = JWT::decode($content['access_token'], $keys['public'], ['RS256']);
$payload = [
"iss" => config('auth.firebaseToken.serviceAccountEmail'),
"sub" => config('auth.firebaseToken.serviceAccountEmail'),
"aud" => config('auth.firebaseToken.aud'),
"iat" => $decoded->iat,
"exp" => $decoded->exp, // Maximum expiration time is one hour
"uid" => $decoded->sub
/* "claims" => array(
"premium_account" => $is_premium_account
) */
];
return JWT::encode($payload, $keys['private'], "RS256");
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Http/Controllers/Api/Auth/Social/SocialController.php | api/app/Http/Controllers/Api/Auth/Social/SocialController.php | <?php
namespace App\Http\Controllers\Api\Auth\Social;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Socialite;
use Validator;
use Illuminate\Validation\Rule;
use App\Models\User\User;
use App\Models\Auth\Social\SocialAccount;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\DB;
class SocialController extends Controller
{
public function redirect(Request $request, $platform)
{
return response()->json(['redirect' => Socialite::driver($platform)->stateless()->with(['state' => $platform])->redirect()->getTargetUrl()]);
}
private function validateRequest(Request $request, $platform)
{
$request->validate([
'client_id' => 'bail|required|string|min:36',
'client_secret' => 'bail|required|string|min:36',
'code' => 'bail|required|string|min:80',
'timezone' => 'required|min:2|max:50|in:' . implode(',', \DateTimeZone::listIdentifiers())
]);
$request->validate([
'client_id' => [
'required',
Rule::exists('oauth_clients', 'id')->where(function ($query) use ($request) {
$query->where('secret', $request->client_secret);
})]
]);
}
private function registerIfNotExist(Request $request, $platform, $providerUser)
{
$user = User::where('client_id', $request->client_id)->where('email', $providerUser->email)->first();
$new_password = str_random(40);
if (!$user) {
DB::transaction(function () use ($request, $platform, $providerUser, $new_password) {
$user = User::create([
'client_id' => $request->client_id,
'name' => title_case($providerUser->name),
'email' => $providerUser->email,
'password' => bcrypt($new_password),
'timezone' => $request->timezone
]);
SocialAccount::updateOrCreate([
'user_id' => $user->id,
'provider' => $platform
], [
'password' => bcrypt($new_password)
]);
});
} else {
SocialAccount::updateOrCreate([
'user_id' => $user->id,
'provider' => $platform
], [
'password' => bcrypt($new_password)
]);
}
return ['username' => $providerUser->email, 'password' => $new_password];
}
private function makeTokens(Request $request, $credentials, $platform)
{
$request->request->add([
'grant_type' => 'password',
'username' => $credentials['username'],
'password' => $credentials['password'],
'platform' => $platform
]);
$tokenRequest = Request::create('api/auth/token', 'post');
return Route::dispatch($tokenRequest);
}
public function login(Request $request, $platform)
{
$this->validateRequest($request, $platform);
$providerUser = Socialite::driver($platform)->stateless()->user();
$user_credentials = $this->registerIfNotExist($request, $platform, $providerUser);
return $this->makeTokens($request, $user_credentials, $platform);
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Http/Middleware/RedirectIfAuthenticated.php | api/app/Http/Middleware/RedirectIfAuthenticated.php | <?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect('/home');
}
return $next($request);
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Http/Middleware/TrustProxies.php | api/app/Http/Middleware/TrustProxies.php | <?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var string
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Http/Middleware/TrimStrings.php | api/app/Http/Middleware/TrimStrings.php | <?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
'password',
'password_confirmation',
];
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Http/Middleware/EncryptCookies.php | api/app/Http/Middleware/EncryptCookies.php | <?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Http/Middleware/VerifyCsrfToken.php | api/app/Http/Middleware/VerifyCsrfToken.php | <?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
//
];
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Mail/EmailVerification.php | api/app/Mail/EmailVerification.php | <?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class EmailVerification extends Mailable
{
use Queueable, SerializesModels;
private $code;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($code)
{
$this->code = $code;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->view('mails.email-verification')
->text('mails.email-verification-plain')
->with(['code' => $this->code]);
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Mail/ForgotPassword.php | api/app/Mail/ForgotPassword.php | <?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class ForgotPassword extends Mailable
{
use Queueable, SerializesModels;
private $token;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($token)
{
$this->token = $token;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->view('mails.forgot-password')
->text('mails.forgot-password-plain')
->with(['token' => $this->token]);
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Console/Kernel.php | api/app/Console/Kernel.php | <?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Models/User/User.php | api/app/Models/User/User.php | <?php
namespace App\Models\User;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Passport\HasApiTokens;
use Illuminate\Database\Eloquent\SoftDeletes;
use Hash;
use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable
{
use HasApiTokens, Notifiable, SoftDeletes, HasRoles;
protected $dates = ['deleted_at'];
protected $guard_name = 'api';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'avatar', 'password', 'client_id', 'timezone'
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'client_id', 'created_at', 'deleted_at', 'updated_at', 'active'
];
public function validateForPassportPasswordGrant($password)
{
if (request()->has('platform')) {
$account = $this->socialAccounts->where('provider', request()->input('platform'))->first();
if (!$account) {
return false;
}
return Hash::check($password, $account->password);
}
return Hash::check($password, $this->getAuthPassword());
}
public function findForPassport($username)
{
return $this->where('client_id', request()->input('client_id'))
->where('email', $username)
->where('active', true)->first();
}
public function socialAccounts()
{
return $this->hasMany('App\Models\Auth\Social\SocialAccount');
}
public function messagingTokens()
{
return $this->hasMany('App\Models\User\MessagingToken');
}
public function notifications()
{
return $this->hasMany('App\Models\User\Notification');
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Models/User/Notification.php | api/app/Models/User/Notification.php | <?php
namespace App\Models\User;
use Illuminate\Database\Eloquent\Model;
class Notification extends Model
{
protected $fillable = ['user_id', 'type', 'color', 'title', 'body', 'payload'];
protected $casts = [
'payload' => 'object',
'created_at' => 'string'
];
protected $hidden = [
'user_id', 'updated_at'
];
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Models/User/MessagingToken.php | api/app/Models/User/MessagingToken.php | <?php
namespace App\Models\User;
use Illuminate\Database\Eloquent\Model;
class MessagingToken extends Model
{
protected $fillable = ['user_id', 'token'];
protected $primaryKey = 'token';
public $incrementing = false;
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Models/Auth/Registration/EmailVerification.php | api/app/Models/Auth/Registration/EmailVerification.php | <?php
namespace App\Models\Auth\Registration;
use Illuminate\Database\Eloquent\Model;
class EmailVerification extends Model
{
protected $fillable = ['client_id', 'email', 'code'];
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Models/Auth/PasswordReset/PasswordReset.php | api/app/Models/Auth/PasswordReset/PasswordReset.php | <?php
namespace App\Models\Auth\PasswordReset;
use Illuminate\Database\Eloquent\Model;
class PasswordReset extends Model
{
protected $fillable = ['user_id', 'token'];
protected $primaryKey = 'user_id';
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Models/Auth/Social/SocialAccount.php | api/app/Models/Auth/Social/SocialAccount.php | <?php
namespace App\Models\Auth\Social;
use Illuminate\Database\Eloquent\Model;
class SocialAccount extends Model
{
protected $fillable = [
'user_id', 'password', 'provider'
];
protected $hidden = [
'password', 'created_at', 'updated_at'
];
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/GraphQL/Type/NotificationType.php | api/app/GraphQL/Type/NotificationType.php | <?php
namespace App\GraphQL\Type;
use GraphQL\Type\Definition\Type;
use Folklore\GraphQL\Support\Type as BaseType;
use GraphQL;
class NotificationType extends BaseType
{
protected $attributes = [
'name' => 'NotificationType',
'description' => 'Notificacion'
];
public function fields()
{
return [
'id' => [
'type' => Type::nonNull(Type::int()),
'description' => 'El id de la notificacion'
],
'type' => [
'type' => Type::nonNull(Type::string()),
'description' => 'Tipo de notificacion'
],
'color' => [
'type' => Type::nonNull(Type::string()),
'description' => 'Color de la notificacion'
],
'title' => [
'type' => Type::nonNull(Type::string()),
'description' => 'Titulo de la notificacion'
],
'body' => [
'type' => Type::nonNull(Type::string()),
'description' => 'Mensaje de la notificacion'
],
'payload' => [
'type' => Type::nonNull(Type::string()),
'description' => 'Datos de la notificacion'
],
'created_at' => [
'type' => Type::nonNull(Type::string()),
'description' => 'Fecha de creacion de la notificacion'
]
];
}
public function resolvePayloadField($root, $args)
{
return json_encode($root->payload);
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/GraphQL/Type/SuccessType.php | api/app/GraphQL/Type/SuccessType.php | <?php
namespace App\GraphQL\Type;
use GraphQL\Type\Definition\Type;
use Folklore\GraphQL\Support\Type as BaseType;
use GraphQL;
class SuccessType extends BaseType
{
protected $attributes = [
'name' => 'SuccessType',
'description' => 'Resultado de la operacion'
];
public function fields()
{
return [
'success' => [
'type' => Type::nonNull(Type::boolean()),
'description' => 'Resultado de la operacion'
]
];
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/GraphQL/Type/UserType.php | api/app/GraphQL/Type/UserType.php | <?php
namespace App\GraphQL\Type;
use GraphQL\Type\Definition\Type;
use Folklore\GraphQL\Support\Type as BaseType;
use GraphQL;
use Auth;
class UserType extends BaseType
{
protected $attributes = [
'name' => 'UserType',
'description' => 'Usuario'
];
public function fields()
{
return [
'id' => [
'type' => Type::nonNull(Type::int()),
'description' => 'El id del usuario'
],
'name' => [
'type' => Type::nonNull(Type::string()),
'description' => 'El nombre del usuario'
],
'email' => [
'type' => Type::nonNull(Type::string()),
'description' => 'El email del usuario'
],
'avatar' => [
'type' => Type::nonNull(Type::string()),
'description' => 'Avatar del usuario'
],
'timezone' => [
'type' => Type::nonNull(Type::string()),
'description' => 'Zona horaria del usuario'
],
'userNotifications' => [
'args' => [
'limit' => [
'name' => 'limit',
'type' => Type::int(),
'description' => 'Limite de notificaciones, minimo uno, maximo 20',
'rules' => ['required', 'numeric', 'min:1', 'max:20']
]
],
'type' => Type::listOf(GraphQL::type('NotificationType')),
'description' => 'Las notificaciones del usuario',
]
];
}
public function resolveUserNotificationsField($root, $args)
{
if (isset($args['limit'])) {
$limit = $args['limit'];
} else {
$limit = 10;
}
return Auth::user()->notifications()->where('open', false)->orderby('created_at', 'desc')->limit($limit)->get();
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/GraphQL/Query/UserNotificationsQuery.php | api/app/GraphQL/Query/UserNotificationsQuery.php | <?php
namespace App\GraphQL\Query;
use Folklore\GraphQL\Support\Query;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
use GraphQL;
use Auth;
use Folklore\GraphQL\Support\Traits\ShouldValidate;
class UserNotificationsQuery extends Query
{
use ShouldValidate;
protected $attributes = [
'name' => 'UserNotificationsQuery',
'description' => 'Las notificaciones del usuario'
];
public function type()
{
return Type::listOf(GraphQL::type('NotificationType'));
}
public function args()
{
return [
'limit' => [
'name' => 'limit',
'type' => Type::int(),
'description' => 'Limite de notificaciones, minimo uno, maximo 20',
'rules' => ['required', 'numeric', 'min:1', 'max:20']
]
];
}
public function resolve($root, $args, $context, ResolveInfo $info)
{
if (isset($args['limit'])) {
$limit = $args['limit'];
} else {
$limit = 10;
}
return Auth::user()->notifications()->where('open', false)->orderby('created_at', 'desc')->limit($limit)->get();
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/GraphQL/Query/UserInfoQuery.php | api/app/GraphQL/Query/UserInfoQuery.php | <?php
namespace App\GraphQL\Query;
use Folklore\GraphQL\Support\Query;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
use GraphQL;
use Auth;
class UserInfoQuery extends Query
{
protected $attributes = [
'name' => 'UserInfoQuery',
'description' => 'Informacion del usuario autenticado'
];
public function type()
{
return Type::listOf(GraphQL::type('UserType'));
}
public function args()
{
return [
];
}
public function resolve($root, $args, $context, ResolveInfo $info)
{
$user = Auth::user();
$user->avatar = asset('storage/avatar/'.$user->avatar);
return [$user];
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/GraphQL/Mutation/UpdateUserAvatarMutation.php | api/app/GraphQL/Mutation/UpdateUserAvatarMutation.php | <?php
namespace App\GraphQL\Mutation;
use Folklore\GraphQL\Support\Mutation;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
use GraphQL;
use Image;
use Validator;
use Auth;
class UpdateUserAvatarMutation extends Mutation
{
protected $attributes = [
'name' => 'saveUserAvatarMutation',
'description' => 'Actualiza el avatar del usuario'
];
public function type()
{
return Type::listOf(GraphQL::type('UserType'));
}
public function args()
{
return [
'image' => [
'name' => 'image',
'type' => Type::nonNull(Type::string()),
'description' => 'Password actual del usuario'
]
];
}
public function rules()
{
Validator::extend('image64', function ($attribute, $value, $parameters, $validator) {
$type = explode('/', explode(':', substr($value, 0, strpos($value, ';')))[1])[1];
if (in_array($type, $parameters)) {
return true;
}
return false;
});
return [
'image' => 'required|image64:jpeg,jpg,png'
];
}
public function resolve($root, $args, $context, ResolveInfo $info)
{
$user = Auth::user();
$avatar_name = md5($user->email.$user->id).'.jpg';
Image::make($args['image'])->save(storage_path('app/public/avatar/') . $avatar_name);
$user->avatar = $avatar_name;
$user->save();
$user->avatar = asset('storage/avatar/' . $user->avatar);
return [$user];
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/GraphQL/Mutation/LogoutMutation.php | api/app/GraphQL/Mutation/LogoutMutation.php | <?php
namespace App\GraphQL\Mutation;
use Folklore\GraphQL\Support\Mutation;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
use GraphQL;
use Auth;
use Illuminate\Support\Facades\DB;
class LogoutMutation extends Mutation
{
protected $attributes = [
'name' => 'LogoutQuery',
'description' => 'Revoca los tokens del usuario autenticado'
];
public function type()
{
return Type::listOf(GraphQL::type('SuccessType'));
}
public function args()
{
return [
'type' => [
'name' => 'type',
'type' => Type::nonNull(Type::string()),
'description' => 'logout revoca el token actual, o logout-all revoca los tokens de todos los dispositivos del usuario',
'rules' => ['required', 'in:logout,logoutAll']
]
];
}
public function resolve($root, $args, $context, ResolveInfo $info)
{
switch ($args['type']) {
case 'logout':
$this->logout();
break;
case 'logoutAll':
$this->logoutAll();
break;
}
return [['success' => true]];
}
private function logout()
{
$accessToken = Auth::user()->token();
DB::transaction(function () use ($accessToken) {
DB::table('oauth_refresh_tokens')->where('access_token_id', $accessToken->id)->update(['revoked' => true]);
$accessToken->revoke();
});
return true;
}
private function logoutAll()
{
$tokens = Auth::user()->tokens()->where('revoked', false)->pluck('id')->toArray();
if (count($tokens)) {
DB::transaction(function () use ($tokens) {
Auth::user()->tokens()->where('revoked', false)->update(['revoked' => true]);
DB::table('oauth_refresh_tokens')->whereIn('access_token_id', $tokens)->update(['revoked' => true]);
});
}
return true;
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/GraphQL/Mutation/SaveFcmTokenMutation.php | api/app/GraphQL/Mutation/SaveFcmTokenMutation.php | <?php
namespace App\GraphQL\Mutation;
use Folklore\GraphQL\Support\Mutation;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
use GraphQL;
use Auth;
use App\Models\User\MessagingToken;
class SaveFcmTokenMutation extends Mutation
{
protected $attributes = [
'name' => 'saveFcmTokenMutation',
'description' => 'Guarda el token de firebase cloud messaging asociado al usuario'
];
public function type()
{
return Type::listOf(GraphQL::type('SuccessType'));
}
public function args()
{
return [
'token' => [
'name' => 'token',
'type' => Type::nonNull(Type::string()),
'description' => 'Token de firebase cloud messaging',
'rules' => ['required', 'string', 'min:152']
]
];
}
public function resolve($root, $args, $context, ResolveInfo $info)
{
return [['success' => $this->save($args['token'])]];
}
private function save($_token)
{
$token = MessagingToken::where('token', $_token)->first();
if ($token) {
return true;
}
$user = Auth::user();
MessagingToken::create([
'token' => $_token,
'user_id' => $user->id
]);
return true;
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/GraphQL/Mutation/UpdateUserInfoMutation.php | api/app/GraphQL/Mutation/UpdateUserInfoMutation.php | <?php
namespace App\GraphQL\Mutation;
use Folklore\GraphQL\Support\Mutation;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
use GraphQL;
use Auth;
class UpdateUserInfoMutation extends Mutation
{
protected $attributes = [
'name' => 'UpdateUserInfoMutation',
'description' => 'Actualiza la informacion del usuario autenticado'
];
public function type()
{
return Type::listOf(GraphQL::type('UserType'));
}
public function args()
{
return [
'name' => [
'name' => 'name',
'type' => Type::string(),
'description' => 'Nombre del usuario'
],
'timezone' => [
'name' => 'timezone',
'type' => Type::string(),
'description' => 'Zona horaria del usuario'
]
];
}
public function rules()
{
return [
'name' => 'string|min:4|max:30',
'timezone' => 'string|min:2|max:50|in:' . implode(',', \DateTimeZone::listIdentifiers())
];
}
public function resolve($root, $args, $context, ResolveInfo $info)
{
$user = Auth::user();
if (isset($args['name']) || isset($args['timezone'])) { // Cuando haya mas parametros que modificar se agregan aqui, por el momento solo hay uno
if (isset($args['name'])) { // Luego se separan individualmente
$user->name = title_case($args['name']);
}
if (isset($args['timezone'])) {
$user->timezone = $args['timezone'];
}
$user->save();
}
return [$user];
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/GraphQL/Mutation/UpdateUserPasswordMutation.php | api/app/GraphQL/Mutation/UpdateUserPasswordMutation.php | <?php
namespace App\GraphQL\Mutation;
use Folklore\GraphQL\Support\Mutation;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
use GraphQL;
use Validator;
use Hash;
use Auth;
class UpdateUserPasswordMutation extends Mutation
{
protected $attributes = [
'name' => 'UpdateUserPasswordMutation',
'description' => 'Actualiza el password del usuario autenticado'
];
public function type()
{
return Type::listOf(GraphQL::type('SuccessType'));
}
public function args()
{
return [
'current_password' => [
'name' => 'current_password',
'type' => Type::nonNull(Type::string()),
'description' => 'Password actual del usuario'
],
'password' => [
'name' => 'password',
'type' => Type::nonNull(Type::string()),
'description' => 'Nuevo password'
],
'password_confirmation' => [
'name' => 'password_confirmation',
'type' => Type::nonNull(Type::string()),
'description' => 'Confirmacion del nuevo password'
]
];
}
public function rules()
{
Validator::extend('current_password', function ($attribute, $value, $parameters, $validator) {
return Hash::check($value, current($parameters));
});
$user = Auth::user();
return [
'current_password' => 'required|min:8|max:30|current_password:' . $user->password,
'password' => 'required|min:8|max:30|confirmed'
];
}
public function resolve($root, $args, $context, ResolveInfo $info)
{
$user = Auth::user();
$user->password = bcrypt($args['password']);
$user->save();
return [['success' => true]];
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Providers/BroadcastServiceProvider.php | api/app/Providers/BroadcastServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Broadcast;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Providers/RouteServiceProvider.php | api/app/Providers/RouteServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
//
parent::boot();
}
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
//
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Providers/EventServiceProvider.php | api/app/Providers/EventServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
'App\Events\Event' => [
'App\Listeners\EventListener',
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
parent::boot();
//
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Providers/AppServiceProvider.php | api/app/Providers/AppServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Laravel\Passport\Passport;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
Passport::ignoreMigrations();
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/app/Providers/AuthServiceProvider.php | api/app/Providers/AuthServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Laravel\Passport\Passport;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
'App\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
if (!config('auth.tokenLifeTime.default')) {
Passport::tokensExpireIn(now()->addSeconds(config('auth.tokenLifeTime.accessToken')));
Passport::refreshTokensExpireIn(now()->addSeconds(config('auth.tokenLifeTime.refreshToken')));
}
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/bootstrap/app.php | api/bootstrap/app.php | <?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/tests/TestCase.php | api/tests/TestCase.php | <?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/tests/CreatesApplication.php | api/tests/CreatesApplication.php | <?php
namespace Tests;
use Illuminate\Support\Facades\Hash;
use Illuminate\Contracts\Console\Kernel;
trait CreatesApplication
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
Hash::driver('bcrypt')->setRounds(4);
return $app;
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/tests/Feature/ExampleTest.php | api/tests/Feature/ExampleTest.php | <?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicTest()
{
$response = $this->get('/');
$response->assertStatus(200);
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/tests/Unit/ExampleTest.php | api/tests/Unit/ExampleTest.php | <?php
namespace Tests\Unit;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicTest()
{
$this->assertTrue(true);
}
}
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/routes/web.php | api/routes/web.php | <?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
return view('welcome');
});
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/routes/channels.php | api/routes/channels.php | <?php
/*
|--------------------------------------------------------------------------
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your
| application supports. The given channel authorization callbacks are
| used to check if an authenticated user can listen to the channel.
|
*/
Broadcast::channel('App.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/routes/api.php | api/routes/api.php | <?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
// Authorization
Route::group(['prefix' => '/auth'], function () {
Route::post('/verification', 'Api\Auth\Registration\VerificationController@generateCode');
Route::post('/registration', 'Api\Auth\Registration\RegistrationController@registration');
Route::post('/forgot', 'Api\Auth\ResetPassword\ForgotController@generateToken');
Route::patch('/reset', 'Api\Auth\ResetPassword\ResetController@resetPassword');
Route::post('/token', 'Api\Auth\Login\CustomAccessTokenController@issueUserToken');
Route::get('/social/{platform}', 'Api\Auth\Social\SocialController@redirect')
->where(['platform' => 'facebook|google']);
Route::post('/social/{platform}', 'Api\Auth\Social\SocialController@login')
->where(['platform' => 'facebook|google']);
});
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/routes/console.php | api/routes/console.php | <?php
use Illuminate\Foundation\Inspiring;
/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->describe('Display an inspiring quote');
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/public/index.php | api/public/index.php | <?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/app.php | api/config/app.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services your application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
LaravelFCM\FCMServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'FCM' => LaravelFCM\Facades\FCM::class,
],
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/client.php | api/config/client.php | <?php
return [
'registrationUrl' => env('CLIENT_REGISTRATION_URL'),
'resetPasswordUrl' => env('CLIENT_RESET_PASSWORD_URL')
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/graphql.php | api/config/graphql.php | <?php
return [
/*
* The prefix for routes
*/
'prefix' => 'graphql',
/*
* The domain for routes
*/
'domain' => null,
/*
* The routes to make GraphQL request. Either a string that will apply
* to both query and mutation or an array containing the key 'query' and/or
* 'mutation' with the according Route
*
* Example:
*
* Same route for both query and mutation
*
* 'routes' => [
* 'query' => 'query/{graphql_schema?}',
* 'mutation' => 'mutation/{graphql_schema?}',
* mutation' => 'graphiql'
* ]
*
* you can also disable routes by setting routes to null
*
* 'routes' => null,
*/
'routes' => '{graphql_schema?}',
/*
* The controller to use in GraphQL requests. Either a string that will apply
* to both query and mutation or an array containing the key 'query' and/or
* 'mutation' with the according Controller and method
*
* Example:
*
* 'controllers' => [
* 'query' => '\Folklore\GraphQL\GraphQLController@query',
* 'mutation' => '\Folklore\GraphQL\GraphQLController@mutation'
* ]
*/
'controllers' => \Folklore\GraphQL\GraphQLController::class.'@query',
/*
* The name of the input variable that contain variables when you query the
* endpoint. Most libraries use "variables", you can change it here in case you need it.
* In previous versions, the default used to be "params"
*/
'variables_input_name' => 'variables',
/*
* Any middleware for the 'graphql' route group
*/
'middleware' => [],
/**
* Any middleware for a specific 'graphql' schema
*/
'middleware_schema' => [
'default' => ['auth:api'],
],
/*
* Any headers that will be added to the response returned by the default controller
*/
'headers' => [],
/*
* Any JSON encoding options when returning a response from the default controller
* See http://php.net/manual/function.json-encode.php for the full list of options
*/
'json_encoding_options' => 0,
/*
* Config for GraphiQL (see (https://github.com/graphql/graphiql).
* To disable GraphiQL, set this to null
*/
/*
'graphiql' => [
'routes' => '/graphiql/{graphql_schema?}',
'controller' => \Folklore\GraphQL\GraphQLController::class.'@graphiql',
'middleware' => [],
'view' => 'graphql::graphiql',
'composer' => \Folklore\GraphQL\View\GraphiQLComposer::class,
],
*/
'graphiql' => null,
/*
* The name of the default schema used when no arguments are provided
* to GraphQL::schema() or when the route is used without the graphql_schema
* parameter
*/
'schema' => 'default',
/*
* The schemas for query and/or mutation. It expects an array to provide
* both the 'query' fields and the 'mutation' fields. You can also
* provide an GraphQL\Type\Schema object directly.
*
* Example:
*
* 'schemas' => [
* 'default' => new Schema($config)
* ]
*
* or
*
* 'schemas' => [
* 'default' => [
* 'query' => [
* 'users' => 'App\GraphQL\Query\UsersQuery'
* ],
* 'mutation' => [
*
* ]
* ]
* ]
*/
'schemas' => [
'default' => [
'query' => [
'userInfo' => 'App\GraphQL\Query\UserInfoQuery',
'userNotifications' => 'App\GraphQL\Query\UserNotificationsQuery'
],
'mutation' => [
'saveFcmToken' => 'App\GraphQL\Mutation\SaveFcmTokenMutation',
'updateUserPassword' => 'App\GraphQL\Mutation\UpdateUserPasswordMutation',
'updateUserInfo' => 'App\GraphQL\Mutation\UpdateUserInfoMutation',
'updateUserAvatar' => 'App\GraphQL\Mutation\UpdateUserAvatarMutation',
'logout' => 'App\GraphQL\Mutation\LogoutMutation'
]
]
],
/*
* Additional resolvers which can also be used with shorthand building of the schema
* using \GraphQL\Utils::BuildSchema feature
*
* Example:
*
* 'resolvers' => [
* 'default' => [
* 'echo' => function ($root, $args, $context) {
* return 'Echo: ' . $args['message'];
* },
* ],
* ],
*/
'resolvers' => [
'default' => [
],
],
/*
* Overrides the default field resolver
* Useful to setup default loading of eager relationships
*
* Example:
*
* 'defaultFieldResolver' => function ($root, $args, $context, $info) {
* // take a look at the defaultFieldResolver in
* // https://github.com/webonyx/graphql-php/blob/master/src/Executor/Executor.php
* },
*/
'defaultFieldResolver' => null,
/*
* The types available in the application. You can access them from the
* facade like this: GraphQL::type('user')
*
* Example:
*
* 'types' => [
* 'user' => 'App\GraphQL\Type\UserType'
* ]
*
* or without specifying a key (it will use the ->name property of your type)
*
* 'types' =>
* 'App\GraphQL\Type\UserType'
* ]
*/
'types' => [
'App\GraphQL\Type\UserType',
'App\GraphQL\Type\SuccessType',
'App\GraphQL\Type\NotificationType'
],
/*
* This callable will receive all the Exception objects that are caught by GraphQL.
* The method should return an array representing the error.
*
* Typically:
*
* [
* 'message' => '',
* 'locations' => []
* ]
*/
'error_formatter' => [\Folklore\GraphQL\GraphQL::class, 'formatError'],
/*
* Options to limit the query complexity and depth. See the doc
* @ https://github.com/webonyx/graphql-php#security
* for details. Disabled by default.
*/
'security' => [
'query_max_complexity' => null,
'query_max_depth' => null,
'disable_introspection' => false
]
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/fcm.php | api/config/fcm.php | <?php
return [
'driver' => env('FCM_PROTOCOL', 'http'),
'log_enabled' => false,
'http' => [
'server_key' => env('FCM_SERVER_KEY', 'Your FCM server key'),
'sender_id' => env('FCM_SENDER_ID', 'Your sender id'),
'server_send_url' => 'https://fcm.googleapis.com/fcm/send',
'server_group_url' => 'https://android.googleapis.com/gcm/notification',
'timeout' => 30.0, // in second
],
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/logging.php | api/config/logging.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 7,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => 'critical',
],
'syslog' => [
'driver' => 'syslog',
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => 'debug',
],
],
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/session.php | api/config/session.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => null,
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using the "apc" or "memcached" session drivers, you may specify a
| cache store that should be used for these sessions. This value must
| correspond with one of the application's configured cache stores.
|
*/
'store' => null,
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
str_slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE', false),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| do not enable this as other CSRF protection services are in place.
|
| Supported: "lax", "strict"
|
*/
'same_site' => null,
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/queue.php | api/config/queue.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_DRIVER', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 90,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('SQS_KEY', 'your-public-key'),
'secret' => env('SQS_SECRET', 'your-secret-key'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'your-queue-name'),
'region' => env('SQS_REGION', 'us-east-1'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'retry_after' => 90,
'block_for' => null,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/cache.php | api/config/cache.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file", "memcached", "redis"
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env(
'CACHE_PREFIX',
str_slug(env('APP_NAME', 'laravel'), '_').'_cache'
),
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/hashing.php | api/config/hashing.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon"
|
*/
'driver' => 'bcrypt',
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/view.php | api/config/view.php | <?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => realpath(storage_path('framework/views')),
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/database.php | api/config/database.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => 'predis',
'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/services.php | api/config/services.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Stripe, Mailgun, SparkPost and others. This file provides a sane
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
],
'ses' => [
'key' => env('SES_KEY'),
'secret' => env('SES_SECRET'),
'region' => 'us-east-1',
],
'sparkpost' => [
'secret' => env('SPARKPOST_SECRET'),
],
'stripe' => [
'model' => App\User::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
],
'google' => [
'client_id' => env('SOCIAL_GOOGLE_CLIENTID'),
'client_secret' => env('SOCIAL_GOOGLE_CLIENTSECRET'),
'redirect' => env('SOCIAL_GOOGLE_REDIRECT')
],
'facebook' => [
'client_id' => env('SOCIAL_FACEBOOK_CLIENTID'),
'client_secret' => env('SOCIAL_FACEBOOK_CLIENTSECRET'),
'redirect' => env('SOCIAL_FACEBOOK_REDIRECT')
]
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/permission.php | api/config/permission.php | <?php
return [
'models' => [
/*
* When using the "HasRoles" trait from this package, we need to know which
* Eloquent model should be used to retrieve your permissions. Of course, it
* is often just the "Permission" model but you may use whatever you like.
*
* The model you want to use as a Permission model needs to implement the
* `Spatie\Permission\Contracts\Permission` contract.
*/
'permission' => Spatie\Permission\Models\Permission::class,
/*
* When using the "HasRoles" trait from this package, we need to know which
* Eloquent model should be used to retrieve your roles. Of course, it
* is often just the "Role" model but you may use whatever you like.
*
* The model you want to use as a Role model needs to implement the
* `Spatie\Permission\Contracts\Role` contract.
*/
'role' => Spatie\Permission\Models\Role::class,
],
'table_names' => [
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'roles' => 'roles',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your permissions. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'permissions' => 'permissions',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your models permissions. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_permissions' => 'model_has_permissions',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your models roles. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_roles' => 'model_has_roles',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles permissions. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'role_has_permissions' => 'role_has_permissions',
],
/*
* By default all permissions will be cached for 24 hours unless a permission or
* role is updated. Then the cache will be flushed immediately.
*/
'cache_expiration_time' => 60 * 24,
/*
* When set to true, the required permission/role names are added to the exception
* message. This could be considered an information leak in some contexts, so
* the default setting is false here for optimum safety.
*/
'display_permission_in_exception' => false,
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/filesystems.php | api/config/filesystems.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
],
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/mail.php | api/config/mail.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
| "sparkpost", "log", "array"
|
*/
'driver' => env('MAIL_DRIVER', 'smtp'),
/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
'port' => env('MAIL_PORT', 587),
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
'sendmail' => '/usr/sbin/sendmail -bs',
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/cors.php | api/config/cors.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Laravel CORS
|--------------------------------------------------------------------------
|
| allowedOrigins, allowedHeaders and allowedMethods can be set to array('*')
| to accept any value.
|
*/
'supportsCredentials' => false,
'allowedOrigins' => ['*'],
'allowedOriginsPatterns' => [],
'allowedHeaders' => ['*'],
'allowedMethods' => ['*'],
'exposedHeaders' => [],
'maxAge' => 0,
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
laqul/laqul | https://github.com/laqul/laqul/blob/da37670fa22c693a566e97e2b57c7d7399e9daac/api/config/broadcasting.php | api/config/broadcasting.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'encrypted' => true,
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];
| php | MIT | da37670fa22c693a566e97e2b57c7d7399e9daac | 2026-01-05T05:16:00.151695Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.