russellwwest

russellwwest

Member Since 8 Months Ago

Experience Points 1,790
Experience
Level
Lessons Completed 11
Lessons
Completed
Best Reply Awards 1
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

14 Sep
1 month ago

russellwwest left a reply on Using A Trait To Apply A Global Scope

Perfect!! Works a charm. With this I will now try and work how to add a create observer in the trait.

Thanks for your help

russellwwest started a new conversation Using A Trait To Apply A Global Scope

Currently I have a global scope that filters models by the logged in user’s account_id. I have used an interface to make sure I implement the boot method on the models I need it on. This works perfectly fine, but is quite repetitive.

So I’d like to know how to implement this global scope through a trait, just like laravel’s own soft deletes trait.

Any tips or helpers in the right direction would be much appreciated?

Thanks

26 Mar
7 months ago

russellwwest left a reply on PUT Request Values Are Empty

My bad! In postman I was sending the data as "form-data". Changing the option of the data type to "x-www-form-urlencoded" fixed the issue :)

russellwwest started a new conversation PUT Request Values Are Empty

I am using Lumen for my API. I have a PUT method for updating a product. However, the data is not available in the request object. Why is that? I've seen a few mentions of having to "fool" it by adding _method = put

Surely for an API framework, PUT should work out the box? or am i not understanding?

Thanks

$router->post('/products', '[email protected]');
$router->get('/products', '[email protected]');
$router->put('/products/{id}', '[email protected]');
$router->get('/products/{id}', '[email protected]');

controller:

public function update($id, Request $request)
    {
        $product = $this->productService->editProduct($id, $request);
        if (! $product) {
            return response()->json(['success' => false], 500);
        } else {
            return response()->json(['success' => true], 200);
        }
    }

service

public function editProduct($id, $request)
    {
        $product = Product::find($id);
        $product->name = $request->input('name');
        $product->description = $request->input('desc');
        if ($product->save()) {
            return true;
        } else {
            return false;
        }
    }
26 Feb
8 months ago

russellwwest left a reply on Fontawesome PHP Brand Icon Won't Load

Hi, as its a brand and in the brand package, instead of fas fa-php you need fab fa-php

russellwwest left a reply on Mail - Object Of Class App\\Mail\\RequestAccepted Could Not Be Converted To Int

Hi Sorry for delay! the trace is below. Thanks

"message": "Object of class App\Mail\RequestAccepted could not be converted to int",
    "exception": "ErrorException",
    "file": "C:\xampp\htdocs\hd2\app\Mail\RequestAccepted.php",
    "line": 42,
    "trace": [
        {
            "file": "C:\xampp\htdocs\hd2\app\Mail\RequestAccepted.php",
            "line": 42,
            "function": "handleError",
            "class": "Illuminate\Foundation\Bootstrap\HandleExceptions",
            "type": "->"
        },
        {
            "function": "build",
            "class": "App\Mail\RequestAccepted",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php",
            "line": 29,
            "function": "call_user_func_array"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php",
            "line": 87,
            "function": "Illuminate\Container\{closure}",
            "class": "Illuminate\Container\BoundMethod",
            "type": "::"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php",
            "line": 31,
            "function": "callBoundMethod",
            "class": "Illuminate\Container\BoundMethod",
            "type": "::"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Container\Container.php",
            "line": 549,
            "function": "call",
            "class": "Illuminate\Container\BoundMethod",
            "type": "::"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Mail\Mailable.php",
            "line": 117,
            "function": "call",
            "class": "Illuminate\Container\Container",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Mail\Mailer.php",
            "line": 250,
            "function": "send",
            "class": "Illuminate\Mail\Mailable",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Mail\Mailer.php",
            "line": 205,
            "function": "sendMailable",
            "class": "Illuminate\Mail\Mailer",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Mail\PendingMail.php",
            "line": 99,
            "function": "send",
            "class": "Illuminate\Mail\Mailer",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\app\Http\Controllers\Helpdesk\Agents\DevelopmentController.php",
            "line": 78,
            "function": "send",
            "class": "Illuminate\Mail\PendingMail",
            "type": "->"
        },
        {
            "function": "accept",
            "class": "App\Http\Controllers\Helpdesk\Agents\DevelopmentController",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Controller.php",
            "line": 54,
            "function": "call_user_func_array"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php",
            "line": 45,
            "function": "callAction",
            "class": "Illuminate\Routing\Controller",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Route.php",
            "line": 212,
            "function": "dispatch",
            "class": "Illuminate\Routing\ControllerDispatcher",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Route.php",
            "line": 169,
            "function": "runController",
            "class": "Illuminate\Routing\Route",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 658,
            "function": "run",
            "class": "Illuminate\Routing\Route",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 30,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php",
            "line": 41,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 149,
            "function": "handle",
            "class": "Illuminate\Routing\Middleware\SubstituteBindings",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Auth\Middleware\Authenticate.php",
            "line": 43,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 149,
            "function": "handle",
            "class": "Illuminate\Auth\Middleware\Authenticate",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php",
            "line": 67,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 149,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\VerifyCsrfToken",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\View\Middleware\ShareErrorsFromSession.php",
            "line": 49,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 149,
            "function": "handle",
            "class": "Illuminate\View\Middleware\ShareErrorsFromSession",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php",
            "line": 63,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 149,
            "function": "handle",
            "class": "Illuminate\Session\Middleware\StartSession",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php",
            "line": 37,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 149,
            "function": "handle",
            "class": "Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php",
            "line": 59,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 149,
            "function": "handle",
            "class": "Illuminate\Cookie\Middleware\EncryptCookies",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 102,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 660,
            "function": "then",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 635,
            "function": "runRouteWithinStack",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 601,
            "function": "runRoute",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 590,
            "function": "dispatchToRoute",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
            "line": 176,
            "function": "dispatch",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 30,
            "function": "Illuminate\Foundation\Http\{closure}",
            "class": "Illuminate\Foundation\Http\Kernel",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\fideloper\proxy\src\TrustProxies.php",
            "line": 56,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 149,
            "function": "handle",
            "class": "Fideloper\Proxy\TrustProxies",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php",
            "line": 30,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 149,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php",
            "line": 30,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 149,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php",
            "line": 27,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 149,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\ValidatePostSize",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php",
            "line": 46,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 149,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 102,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
            "line": 151,
            "function": "then",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
            "line": 116,
            "function": "sendRequestThroughRouter",
            "class": "Illuminate\Foundation\Http\Kernel",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\hd2\public\index.php",
            "line": 55,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Kernel",
            "type": "->"
        }
    ]
23 Feb
8 months ago

russellwwest started a new conversation Mail - Object Of Class App\\Mail\\RequestAccepted Could Not Be Converted To Int

HI, I have a Mail class that is sent when a user accepts a class. However, when I call the mail I get the following error "Object of class App\Mail\RequestAccepted could not be converted to int"

This is how I am sending the mail:

Mail::to('[email protected]')->send(new RequestAccepted(Auth::user(),$dev));

This is the Mail class for RequestAccepted

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\User;
use App\Organisation;

class RequestAccepted extends Mailable
{
    use Queueable, SerializesModels;

    protected $name;
    protected $org;
    protected $req;
    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct(User $user, $dev)
    {
        $this->name = $user->name;
        $this->org = Organisation::find($user->organisation_id);
        $this->req = $dev->title;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->markdown('emails.requests.accepted')
            -with([
                'name' => $this->name,
                'org' => $this->org->name,
                'dev' => $this->req
            ]);
    }
}

And this is the Markdown email:

@component('mail::message')
## Development Request Quote Accepted

Dear Russell,

A quote for development request {{$dev}} has been accepted by {{$name}}

Thanks,<br>
@endcomponent

Any ideas what is causing this error message?

Thanks in advance