This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class A { | |
public function nonStaticMethod(){ | |
echo "I am non-static"; | |
} | |
public static function staticMethod() { | |
echo "I am static" . self::nonStaticMethod(); // Throws error: Non-static method cannot be called statically | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class A { | |
public static function staticMethod() { | |
echo "I am static"; | |
} | |
public function nonStaticMethod() { | |
echo "I am not static" . self::staticMethod(); // This works nicely. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class A { | |
public function staticMethod() { | |
echo get_class($this); | |
} | |
public function otherStaticMethod() { | |
self::staticMethod(); // This runs nicely. We can use self:: to access static methods from other static methods. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Animal { | |
public static function makeSound(){ | |
echo "Animal"; | |
} | |
public static function vocalize() { | |
echo self::makeSound(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Employer\Dashboard; | |
use App\Http\Controllers\Controller; | |
use App\Models\User; | |
class HomeController extends Controller | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
use Illuminate\Database\Eloquent\Model; | |
class User extends Model | |
{ | |
/** | |
* The booted method of the model |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Employer\Dashboard; | |
use App\Http\Controllers\Controller; | |
use App\Models\User; | |
class HomeController extends Controller | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Employer\Dashboard; | |
use App\Http\Controllers\Controller; | |
use App\Models\User; | |
class HomeController extends Controller | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
use Illuminate\Database\Eloquent\Model; | |
class User extends Model | |
{ | |
/** | |
* The attributes that should be cast. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Employer\Dashboard; | |
use App\Http\Controllers\Controller; | |
use App\Models\User; | |
class HomeController extends Controller | |
{ |