add back findWithoutFail

This commit is contained in:
Nabeel Shahzad
2017-10-31 21:29:40 -04:00
parent 7b0a1c12e7
commit d48a02dd32
3 changed files with 34 additions and 4 deletions

7
.idea/php.xml generated
View File

@@ -115,6 +115,11 @@
<path value="$PROJECT_DIR$/vendor/doctrine/cache" />
<path value="$PROJECT_DIR$/vendor/hashids/hashids" />
<path value="$PROJECT_DIR$/vendor/makinacorpus/php-bloom" />
<path value="$PROJECT_DIR$/vendor/php-http/httplug" />
<path value="$PROJECT_DIR$/vendor/php-http/promise" />
<path value="$PROJECT_DIR$/vendor/egulias/email-validator" />
<path value="$PROJECT_DIR$/vendor/psr/container" />
<path value="$PROJECT_DIR$/vendor/psr/simple-cache" />
</include_path>
</component>
<component name="PhpProjectServersManager">
@@ -130,7 +135,7 @@
<component name="PhpProjectSharedConfiguration" php_language_level="7" />
<component name="PhpUnit">
<phpunit_settings>
<PhpUnitSettings load_method="CUSTOM_LOADER" custom_loader_path="/Users/nshahzad/Dropbox/dev/personal/phpvms/bootstrap/autoload.php" phpunit_phar_path="" />
<PhpUnitSettings load_method="CUSTOM_LOADER" custom_loader_path="$PROJECT_DIR$/bootstrap/autoload.php" phpunit_phar_path="" />
</phpunit_settings>
</component>
</project>

View File

@@ -7,7 +7,17 @@ use Illuminate\Validation\Validator;
abstract class BaseRepository extends \Prettus\Repository\Eloquent\BaseRepository {
public function validate($values) {
public function findWithoutFail($id, $columns = ['*'])
{
try {
return $this->find($id, $columns);
} catch (Exception $e) {
return;
}
}
public function validate($values)
{
$validator = Validator::make(
$values,
$this->model()->rules

View File

@@ -12,6 +12,7 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/common" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/dbal" />
<excludeFolder url="file://$MODULE_DIR$/vendor/dompdf/dompdf" />
<excludeFolder url="file://$MODULE_DIR$/vendor/egulias/email-validator" />
<excludeFolder url="file://$MODULE_DIR$/vendor/ellipsesynergie/api-response" />
<excludeFolder url="file://$MODULE_DIR$/vendor/hashids/hashids" />
<excludeFolder url="file://$MODULE_DIR$/vendor/jeremeamia/SuperClosure" />
@@ -21,7 +22,11 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phenx/php-font-lib" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phenx/php-svg-lib" />
<excludeFolder url="file://$MODULE_DIR$/vendor/php-http/httplug" />
<excludeFolder url="file://$MODULE_DIR$/vendor/php-http/promise" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phpoffice/phpexcel" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/container" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/simple-cache" />
<excludeFolder url="file://$MODULE_DIR$/vendor/scriptfusion/phpunit-immediate-exception-printer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/spatie/fractalistic" />
<excludeFolder url="file://$MODULE_DIR$/vendor/spatie/laravel-fractal" />
@@ -42,6 +47,7 @@
<root url="file://$MODULE_DIR$/vendor/doctrine/common" />
<root url="file://$MODULE_DIR$/vendor/doctrine/dbal" />
<root url="file://$MODULE_DIR$/vendor/dompdf/dompdf" />
<root url="file://$MODULE_DIR$/vendor/egulias/email-validator" />
<root url="file://$MODULE_DIR$/vendor/ellipsesynergie/api-response" />
<root url="file://$MODULE_DIR$/vendor/hashids/hashids" />
<root url="file://$MODULE_DIR$/vendor/jeremeamia/SuperClosure" />
@@ -51,7 +57,11 @@
<root url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
<root url="file://$MODULE_DIR$/vendor/phenx/php-font-lib" />
<root url="file://$MODULE_DIR$/vendor/phenx/php-svg-lib" />
<root url="file://$MODULE_DIR$/vendor/php-http/httplug" />
<root url="file://$MODULE_DIR$/vendor/php-http/promise" />
<root url="file://$MODULE_DIR$/vendor/phpoffice/phpexcel" />
<root url="file://$MODULE_DIR$/vendor/psr/container" />
<root url="file://$MODULE_DIR$/vendor/psr/simple-cache" />
<root url="file://$MODULE_DIR$/vendor/scriptfusion/phpunit-immediate-exception-printer" />
<root url="file://$MODULE_DIR$/vendor/spatie/fractalistic" />
<root url="file://$MODULE_DIR$/vendor/spatie/laravel-fractal" />
@@ -70,6 +80,7 @@
<root url="file://$MODULE_DIR$/vendor/doctrine/common" />
<root url="file://$MODULE_DIR$/vendor/doctrine/dbal" />
<root url="file://$MODULE_DIR$/vendor/dompdf/dompdf" />
<root url="file://$MODULE_DIR$/vendor/egulias/email-validator" />
<root url="file://$MODULE_DIR$/vendor/ellipsesynergie/api-response" />
<root url="file://$MODULE_DIR$/vendor/hashids/hashids" />
<root url="file://$MODULE_DIR$/vendor/jeremeamia/SuperClosure" />
@@ -79,7 +90,11 @@
<root url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
<root url="file://$MODULE_DIR$/vendor/phenx/php-font-lib" />
<root url="file://$MODULE_DIR$/vendor/phenx/php-svg-lib" />
<root url="file://$MODULE_DIR$/vendor/php-http/httplug" />
<root url="file://$MODULE_DIR$/vendor/php-http/promise" />
<root url="file://$MODULE_DIR$/vendor/phpoffice/phpexcel" />
<root url="file://$MODULE_DIR$/vendor/psr/container" />
<root url="file://$MODULE_DIR$/vendor/psr/simple-cache" />
<root url="file://$MODULE_DIR$/vendor/scriptfusion/phpunit-immediate-exception-printer" />
<root url="file://$MODULE_DIR$/vendor/spatie/fractalistic" />
<root url="file://$MODULE_DIR$/vendor/spatie/laravel-fractal" />
@@ -93,11 +108,11 @@
<orderEntry type="module-library">
<library name="PHARS">
<CLASSES>
<root url="phar://$MODULE_DIR$/vendor/phpunit/phpunit/tests/_files/phpunit-example-extension/tools/phpunit.d/phpunit-example-extension-1.0.1.phar/" />
<root url="phar://$MODULE_DIR$/vendor/phpunit/phpunit/tests/_files/phpunit-example-extension/tools/phpunit.d/phpunit-example-extension-1.0.0.phar/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="phar://$MODULE_DIR$/vendor/phpunit/phpunit/tests/_files/phpunit-example-extension/tools/phpunit.d/phpunit-example-extension-1.0.1.phar/" />
<root url="phar://$MODULE_DIR$/vendor/phpunit/phpunit/tests/_files/phpunit-example-extension/tools/phpunit.d/phpunit-example-extension-1.0.0.phar/" />
</SOURCES>
</library>
</orderEntry>