Answers for "how to call trait function in laravel"

PHP
0

laravel make trait command

php artisan make:trait nameOfTheTrait
Posted by: Guest on February-03-2021
1

php override trait method and call it

trait A {
    function calc($v) {
        return $v+1;
    }
}

class MyClass {
    use A {
        calc as protected traitcalc;
    }

    function calc($v) {
        $v++;
        return $this->traitcalc($v);
    }
}
Posted by: Guest on May-05-2020
1

how use trait in laravel

<?php
 
namespace App\Traits;
 
trait StoreImageTrait {
 
    public function verifyAndStoreImage() {
 
    }
 
}
Posted by: Guest on September-20-2021

Code answers related to "how to call trait function in laravel"

Browse Popular Code Answers by Language