Čamo

Čamo

Member Since 4 Years Ago

Experience Points
2,030
Total
Experience

2,970 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
2
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
2,030 XP
Sep
18
13 hours ago
Activity icon

Replied to Is This Eloquent Query Right?

Ok I have it.

Activity icon

Replied to Is This Eloquent Query Right?

Thank you. Hope I understand.

Activity icon

Started a new Conversation Is This Eloquent Query Right?

I found this query in one project I am facing right now but I am not sure what it actually does. It seems like a duplicate or redundant query.

$attributes = Attribute::with(['values.variants' => function ($query) use ($product) {
        $query->where('product_id', $product->id);
    }])->whereHas('values.variants', function($query) use ($product){
        $query->where('product_id', $product->id);
    })->get();

What is the difference between closure in with array and the whereHas() call. It seems like the same.

Sep
17
1 day ago
Activity icon

Replied to Connection Could Not Be Established With Host :stream_socket_client(): Unable To Connect To Tsl://:465

My bad. I am very sorry, some parts of code calls Mail::to(evn("MAIL_USERNAME")) which is not a valid email. I didnt expect it.

Activity icon

Replied to Connection Could Not Be Established With Host :stream_socket_client(): Unable To Connect To Tsl://:465

If I turn encryption off then I am getting new error about RFC.

Address in mailbox given [c8744462ac538a] does not comply with RFC 2822, 3.6.2

where c8744462ac538a is valid username for mailtrap.io Why this throws an error?

Activity icon

Replied to Jquery Error: $ Is Not Defined

YEEES! This is it. Thanks a lot. @sinnbeck

Activity icon

Replied to Jquery Error: $ Is Not Defined

Yes it was only a try...

Activity icon

Replied to Jquery Error: $ Is Not Defined

The weird is the project commonly uses $('selector') call in other places only in layout.blade.php it throws error. What is wrong with that?

Activity icon

Replied to Jquery Error: $ Is Not Defined

@sinnbeck now the same line throws an error $ is not a function

Activity icon

Started a new Conversation Jquery Error: $ Is Not Defined

hi, I have a simple html

  <script src="{{ mix('js/app.js') }}"></script>
  <script defer>
    $(document).ready(function () {
      $("#basket-modal").modal();
    })
  </script>

app.js contains the code:

import "jquery";
import 'bootstrap';
...

The question is why javascript throws me an error on $(document).ready() that $ is not defined?

Sep
16
2 days ago
Activity icon

Replied to Connection Could Not Be Established With Host :stream_socket_client(): Unable To Connect To Tsl://:465

@laracoft it is Laravel 5.7.

.env has MAIL_DRIVER=smtp

mail.php has 'driver' => env('MAIL_DRIVER', 'smtp'),

it should be ok.

Activity icon

Replied to Connection Could Not Be Established With Host :stream_socket_client(): Unable To Connect To Tsl://:465

@laracoft here is error log. I am lost in it.

[2020-09-16 13:55:05] development.ERROR: Connection could not be established with host  :stream_socket_client(): unable to connect to tsl://:465 (Unable to find the socket transport &quot;tsl&quot; - did you forget to enable it when you configured PHP?) {"exception":"[object] (Swift_TransportException(code: 0): Connection could not be established with host  :stream_socket_client(): unable to connect to tsl://:465 (Unable to find the socket transport &quot;tsl&quot; - did you forget to enable it when you configured PHP?) at C:\wamp64-3-2-0\www\
atura-backend\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php:269)
[stacktrace]
#0 [internal function]: Swift_Transport_StreamBuffer->{closure}(2, 'stream_socket_c...', 'C:\\wamp64-3-2-0...', 272, Array)
#1 C:\wamp64-3-2-0\www\
atura-backend\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php(272): stream_socket_client('tsl://:465', -1306425416, 'Unable to find ...', 30, 4, Resource id #738)
#2 C:\wamp64-3-2-0\www\
atura-backend\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php(58): Swift_Transport_StreamBuffer->establishSocketConnection()
#3 C:\wamp64-3-2-0\www\
atura-backend\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php(143): Swift_Transport_StreamBuffer->initialize(Array)
#4 C:\wamp64-3-2-0\www\
atura-backend\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Mailer.php(65): Swift_Transport_AbstractSmtpTransport->start()
#5 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Mail\Mailer.php(483): Swift_Mailer->send(Object(Swift_Message), Array)
#6 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Mail\Mailer.php(259): Illuminate\Mail\Mailer->sendSwiftMessage(Object(Swift_Message))
#7 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Mail\Mailable.php(159): Illuminate\Mail\Mailer->send('emails.register', Array, Object(Closure))
#8 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Support\Traits\Localizable.php(19): Illuminate\Mail\Mailable->Illuminate\Mail\{closure}()
#9 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Mail\Mailable.php(160): Illuminate\Mail\Mailable->withLocale(NULL, Object(Closure))
#10 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Mail\Mailer.php(274): Illuminate\Mail\Mailable->send(Object(Illuminate\Mail\Mailer))
#11 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Mail\Mailer.php(229): Illuminate\Mail\Mailer->sendMailable(Object(App\Mail\RegisterForm))
#12 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Mail\PendingMail.php(124): Illuminate\Mail\Mailer->send(Object(App\Mail\RegisterForm))
#13 C:\wamp64-3-2-0\www\
atura-backend\app\Http\Controllers\PaymentController.php(176): Illuminate\Mail\PendingMail->send(Object(App\Mail\RegisterForm))
#14 [internal function]: App\Http\Controllers\PaymentController->placeOrders(Object(Illuminate\Http\Request))
#15 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Controller.php(54): call_user_func_array(Array, Array)
#16 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('placeOrders', Array)
#17 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Route.php(219): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\PaymentController), 'placeOrders')
#18 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Route.php(176): Illuminate\Routing\Route->runController()
#19 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Router.php(682): Illuminate\Routing\Route->run()
#20 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#21 C:\wamp64-3-2-0\www\
atura-backend\app\Http\Middleware\SessionFilter.php(22): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#22 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): App\Http\Middleware\SessionFilter->handle(Object(Illuminate\Http\Request), Object(Closure))
#23 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#24 C:\wamp64-3-2-0\www\
atura-backend\app\Http\Middleware\SeoDataMiddleware.php(98): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#25 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): App\Http\Middleware\SeoDataMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#26 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#27 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#28 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#29 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#30 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php(75): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#31 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#32 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#33 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\View\Middleware\ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#34 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#35 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#36 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php(63): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#37 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#38 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#39 C:\wamp64-3-2-0\www\
atura-backend\app\Http\Middleware\SetLocale.php(23): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#40 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): App\Http\Middleware\SetLocale->handle(Object(Illuminate\Http\Request), Object(Closure))
#41 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#42 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#43 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#44 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#45 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php(66): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#46 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#47 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#48 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#49 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Router.php(684): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#50 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Router.php(659): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#51 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Router.php(625): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#52 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Router.php(614): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#53 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#54 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#55 C:\wamp64-3-2-0\www\
atura-backend\vendor\barryvdh\laravel-debugbar\src\Middleware\InjectDebugbar.php(65): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#56 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle(Object(Illuminate\Http\Request), Object(Closure))
#57 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#58 C:\wamp64-3-2-0\www\
atura-backend\vendor\fideloper\proxy\src\TrustProxies.php(57): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#59 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#60 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#61 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(31): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#62 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#63 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#64 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(31): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#65 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#66 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#67 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#68 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#69 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#70 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php(62): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#71 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#72 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#73 C:\wamp64-3-2-0\www\
atura-backend\vendor\barryvdh\laravel-cors\src\HandlePreflight.php(29): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#74 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(163): Barryvdh\Cors\HandlePreflight->handle(Object(Illuminate\Http\Request), Object(Closure))
#75 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#76 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#77 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#78 C:\wamp64-3-2-0\www\
atura-backend\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#79 C:\wamp64-3-2-0\www\
atura-backend\public\index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#80 C:\wamp64-3-2-0\www\
atura-backend\server.php(21): require_once('C:\\wamp64-3-2-0...')
#81 {main}
Activity icon

Replied to Connection Could Not Be Established With Host :stream_socket_client(): Unable To Connect To Tsl://:465

I will try to change that driver. config/mail.php is based on env(). It should be ok.

<?php

return [

    'driver' => env('MAIL_DRIVER', 'smtp'),

    'host' => env('MAIL_HOST', 'smtp.mailgun.org'),

    'port' => env('MAIL_PORT', 587),

    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
        'name' => env('MAIL_FROM_NAME', 'Example'),
    ],

    'encryption' => env('MAIL_ENCRYPTION', 'tls'),

    'username' => env('MAIL_USERNAME'),

    'password' => env('MAIL_PASSWORD'),

    'sendmail' => '/usr/sbin/sendmail -bs',

    'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],

    'log_channel' => env('MAIL_LOG_CHANNEL'),

];
Activity icon

Replied to Connection Could Not Be Established With Host :stream_socket_client(): Unable To Connect To Tsl://:465

Still the same. I tried to rewrite .env to ssl, tls, tsl always run config:clear but still the same error. Any other suggestions?

Activity icon

Started a new Conversation Connection Could Not Be Established With Host :stream_socket_client(): Unable To Connect To Tsl://:465

I am trying to send email from localhost to https://mailtrap.io/ but getting an error: Swift_TransportException Connection could not be established with host :stream_socket_client(): unable to connect to tsl://:465 (Unable to find the socket transport "tsl" - did you forget to enable it when you configured PHP?)

.env file looks like:

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=xxxxxxx
MAIL_PASSWORD=yyyyyyy
MAIL_ENCRYPTION=tls

All settings are copied from mailtrap for Laravel. But I am not sure cause my Laravel version is 5.7. Why error message says port 465 if .env port is 2525? Php open_ssl is enabled. Any suggestions? Thanks a lot.

Sep
09
1 week ago
Activity icon

Replied to Filtering Items Via BelongsToMany Relation

Ok díky. To je cele. Potreboval som to pochopiť.

Activity icon

Replied to Filtering Items Via BelongsToMany Relation

If i understand this filter is implemented on php level? Not on database layer? How this closure works? It is not the sql is it?

Activity icon

Started a new Conversation Filtering Items Via BelongsToMany Relation

Hi, I have two models - product ans categories. They are in M:N relation (belongsToMany). I need to filter products via categories but dont know how to do it. How sould it look like? I though something like:

$products->where('category.slug', $categorySlug);

but this does not work.

Sep
08
1 week ago
Activity icon

Started a new Conversation Images From Storage

Hi, I have a little problem with getting an images from storage. Images are stored in storage/app/public/uploads/files directory. In database they are stored as file name image-1.png ... I am getting the files via url generated in Eloquent entity and url looks like src="/uploads/files/image-1.png" But cant see any image. Images are stored manually. Can somebody tell me please where is the problem?

Sep
05
1 week ago
Activity icon

Replied to What Is Boot In Model

Ok thanks for help. It is little weird code...

Activity icon

Replied to What Is Boot In Model

Ok I have more specific problem. This code uses something like (new SeoController())->updateModel($model)

    protected static function boot()
    {
        parent::boot();
        self::saved(function ($model) {
            (new SeoController())->updateModel($model);
        });
        self::created(function ($model) {
            (new SeoController())->updateModel($model);
        });
        self::retrieved(function ($model) {
            if (app()->getLocale() != config('app.fallback_locale')) {
                $model->localize();
            }
        });

What pattern is it? Why controller is called from model. It looks like anti-pattern.

Activity icon

Started a new Conversation What Is Boot In Model

I would like to know how boot method works in Model classes but I dont see it in documentation. Can somebody give me a link to doc?

class Product extends Model 
{
	protectd static function boot()
	{

	}
}
Sep
01
2 weeks ago
Activity icon

Started a new Conversation How To Make Efficient Query For $post->commnets And Comment->user

Hello, I have a Post model which hasMany Commnets and every comment has one User. If I run this blade code

@foreach( $post->comments as $comment )
      <div>{{ $comment->text }} <br><small>{{ $comment->user->name }}</small></div>
@endforeach

it makes one separate query for user in every loop of the foreach cycle.

I know about Post::with() but this is the third level of relations. Is it possible to have only one query for all users which wrote comments?

Controller code looks like

public function detail(Post $post)
{
	return view('home.detail')->with([
		'post' => $post
	]);
}
Aug
13
1 month ago
Activity icon

Replied to Laravel + React + Axios Does Not Detect Ajax Request

@sinnbeck Yes it works. Thanks for help. Weird that Axios does not send this header....

Activity icon

Replied to Laravel + React + Axios Does Not Detect Ajax Request

React is separate application. It is not based on Laravel. But if I understand it I need to set up axios headers. Am I right?

Activity icon

Started a new Conversation Laravel + React + Axios Does Not Detect Ajax Request

I need to make ajax form submit from my React app to my backend app based on Laravel. But Laravel is not able to recognize ajax request from Axios. I dont understand cause Axios is common used ajax library. It is weird. The ajax call looks like:

		axios({
			method: 'POST',
			url: 'http://localhost:8000/login',
			data: formData,
			headers: {
				'Content-Type': 'text/html'
			}
		})
			.then(response => {
				// ? returns undefined if variable is undefined
				if( response.data?.errors?.length ) this.setState({errors: response.data.errors})
			})
			.catch(response => {
				console.log(response)
				this.setState({errors: ['Login fails. Try it again later please.']})
			});

and the backend Laravel ajax check

	public function login(Request $request, TokenService $tokenService)
	{
		if( $request->ajax() )  // FALSE
		{
			// Unreachable code
		}

I hope this is common use case which have simple solution. Thanks for any help.

Aug
11
1 month ago
Activity icon

Awarded Best Reply on Cors Issue With Login From Localhost:3000 To Localhost:8000

So the problem is in middleware header() call. It should be headers->set()

    public function handle($request, Closure $next)
    {
        $response = $next($request);
        $response->headers->set('Access-Control-Allow-Origin', '*');

        return $response;
    }
Aug
10
1 month ago
Activity icon

Replied to Cors Issue With Login From Localhost:3000 To Localhost:8000

So the problem is in middleware header() call. It should be headers->set()

    public function handle($request, Closure $next)
    {
        $response = $next($request);
        $response->headers->set('Access-Control-Allow-Origin', '*');

        return $response;
    }
Activity icon

Replied to Cors Issue With Login From Localhost:3000 To Localhost:8000

I check it but this is not the reason.

Activity icon

Started a new Conversation Cors Issue With Login From Localhost:3000 To Localhost:8000

Hi, I have a problem with Cors policy. I would like to make ajax request from browser on localhost:3000 to server on localhost:8000. But I am getting an error: Access to XMLHttpRequest at 'localhost:8000/login' from origin 'http://localhost:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. I made some necessary change to handle CROS origin. Here is config/cors.php

<?php

return [

    'paths' => ['api/*', 'login/', 'logout/'],

    'allowed_methods' => ['*'],

    'allowed_origins' => ['*'],

    'allowed_origins_patterns' => [],

    'allowed_headers' => ['*'],

    'exposed_headers' => [],

    'max_age' => 0,

    'supports_credentials' => false,

];

and here is the js part:

	sendData(e)
	{
		e.preventDefault();

		window.axios({
			method: 'post',
			url: 'localhost:8000/login',
			data: {email: this.state.email, password: this.state.password},
			headers: {
				'Content-Type': 'multipart/form-data'
			}
		})
			.then(function (response) {
				console.log(response);
			})
			.catch(function (response) {
				console.log(response);
			});
	}

I also tried to make middleware which send

header("Access-Control-Allow-Origin: *");

What should I do to make it works? Thanks a lot for any help.

Aug
06
1 month ago
Activity icon

Replied to Migration For Creating Database

Ok I understand.

Activity icon

Started a new Conversation Migration For Creating Database

Hi, is it possible to create database with migrations. I try to make migration for it but it throws me an error: SQLSTATE[HY000] [1049] Unknown database 'laravel-react' (SQL: select * from information_schema.tables where table_schema = laravel-react and table_name = migrations and table_type = 'BASE TABLE')

    public function up()
    {
		DB::statement('
			CREATE DATABASE IF NOT EXISTS laravel-react 
			DEFAULT CHARACTER SET utf8mb4 
			COLLATE utf8mb4_slovak_ci;
			USE laravel-react;
		');
    }

I would like to have DB creation included in migrations not as a separate artisan command.

Aug
04
1 month ago
Activity icon

Replied to How To Validate Multiple File Upload In Request

This is really nasty

@if( $errors->all() )
    <?php $imgsErrors = [] ?>
        @foreach( $errors->all() as $e )
            @if( strpos( $e, 'image' ) !== FALSE )<?php $imgsErrors[$e] = __($e); ?>@endif
        @endforeach
    <div class="text-danger">{{ join('<br>', $imgsErrors) }}</div>
@endIf
Activity icon

Replied to How To Validate Multiple File Upload In Request

So the problem is Laravel for multi upload errors creates key which does not match the key defined in rules. It creates this

Illuminate\Support\ViewErrorBag {#444 ▼
  #bags: array:1 [▼
    "default" => Illuminate\Support\MessageBag {#445 ▼
      #messages: array:1 [▼
        "images.1" => array:1 [▼
          0 => "forms.createBook.image_image"
        ]
      ]
      #format: ":message"
    }
  ]
}
Activity icon

Started a new Conversation How To Validate Multiple File Upload In Request

I have a form with multi upload. Validation is stored in CustomRequest object. Request has this rule for uploaded files:

			// rules
			$rules['images.*'] = 'required|image';

			...

			// messages
			'images.*.image' => 'forms.createBook.image_image',

The problem is the error is not asigned to images input. I am able to see it in $errors->all() but cant get it via @error('images'){{$message}}@enderror

What is the problem with rule 'images.*.image'?

Activity icon

Replied to Where My DefaultLocale Comes From

So we dont know how Laravel resolve defaultLocale in request object? Ok it does not matter now. Thanks for help @nakov @michaloravec

Aug
03
1 month ago
Activity icon

Replied to Where My DefaultLocale Comes From

But locale is also 'sk'. this is my config/app.php

    'locale' => 'sk',

    'default_locale' => 'sk',

    'fallback_locale' => 'sk',

I made default_locale because of this issue.

Activity icon

Started a new Conversation Where My DefaultLocale Comes From

Hi, can somebody tell me please where Laravels Request instance getting a default locale value? I have this line in config/app.php

	'default_locale' => 'sk',

but Request instance have defaultValue set to en. How is it possible?

Jul
31
1 month ago
Activity icon

Replied to Router - Is It Possible To Stop Sending Route Parameter To Controller Action

@michaloravec Thanks for help. Package looks little complicated. I have two methods which generates links and one middleware for incoming requests. Everyhing works. Hope so....

Activity icon

Replied to Router - Is It Possible To Stop Sending Route Parameter To Controller Action

@talinon This is it. Thanks a lot. I didn not know about forgetParameter. It seems everything works as expected. Thanks a lot.

Activity icon

Replied to Router - Is It Possible To Stop Sending Route Parameter To Controller Action

No the problem is if project has tens of methods every one has to have this redundant parameter. It was only an example with one route and one method. It also has to handle routes with or without local parameters e.g. example.com/slug and example.com/en/slug