for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Microboard\Foundations\Traits;
use Illuminate\Http\Request;
trait DependencyResolverTrait
{
/**
* @return string
*/
protected function getModel(): string
return app()->getNamespace() . $this->baseName;
baseName
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
}
protected function getDatatable(): string
return app()->getNamespace() . 'DataTables\\' . str_replace('Controller', 'DataTable', class_basename($this));
protected function getStoreFormRequest(): string
return app()->getNamespace() . 'Http\\Requests\\' . $this->baseName . '\\StoreFormRequest';
protected function getUpdateFormRequest(): string
return app()->getNamespace() . 'Http\\Requests\\' . $this->baseName . '\\UpdateFormRequest';
* @param Request $request
* @return mixed
protected function getValidated(Request $request)
return array_filter($request->validated(), function ($input) {
return !empty($input);
});
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: