Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/Repositories/NullModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
use Illuminate\Database\Eloquent\Model;

/**
* @package Binaryk\LaravelRestify\Repositories;
* @author Eduard Lupacescu <eduard.lupacescu@binarcode.com>
*/
class NullModel extends Model
{
use InteractWithSQLight;

public $rows = [];

}
14 changes: 7 additions & 7 deletions src/Traits/AuthorizableModels.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static function authorizable()
*/
public function authorizeToShowAny(Request $request)
{
if ( ! static::authorizable()) {
if (! static::authorizable()) {
return;
}

Expand All @@ -61,7 +61,7 @@ public function authorizeToShowAny(Request $request)
*/
public static function authorizedToShowAny(Request $request)
{
if ( ! static::authorizable()) {
if (! static::authorizable()) {
return true;
}

Expand All @@ -71,15 +71,15 @@ public static function authorizedToShowAny(Request $request)
}

/**
* Determine if the resource should be available for the given request (
* Determine if the resource should be available for the given request (.
*
* @param \Illuminate\Http\Request $request
* @return void
* @throws AuthorizationException
*/
public function authorizeToShowEvery(Request $request)
{
if ( ! static::authorizable()) {
if (! static::authorizable()) {
return;
}

Expand All @@ -96,7 +96,7 @@ public function authorizeToShowEvery(Request $request)
*/
public static function authorizedToShowEvery(Request $request)
{
if ( ! static::authorizable()) {
if (! static::authorizable()) {
return true;
}

Expand Down Expand Up @@ -137,7 +137,7 @@ public function authorizedToShow(Request $request)
*/
public static function authorizeToStore(Request $request)
{
if ( ! static::authorizedToStore($request)) {
if (! static::authorizedToStore($request)) {
throw new AuthorizationException('Unauthorized to store.');
}
}
Expand Down Expand Up @@ -252,7 +252,7 @@ public function determineModel()
}

/**
* Determine if the trait is used by repository or model
* Determine if the trait is used by repository or model.
*
* @return bool
*/
Expand Down
8 changes: 3 additions & 5 deletions src/Traits/InteractWithSQLight.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Illuminate\Support\Str;

/**
* @package App\Models;
* @author Eduard Lupacescu <eduard.lupacescu@binarcode.com>
*/
trait InteractWithSQLight
Expand All @@ -21,9 +20,9 @@ public static function resolveConnection($connection = null)
public static function bootSushi()
{
$instance = (new static);
$cacheFileName = 'sushi-' . Str::kebab(str_replace('\\', '', static::class)) . '.sqlite';
$cacheFileName = 'sushi-'.Str::kebab(str_replace('\\', '', static::class)).'.sqlite';
$cacheDirectory = realpath(config('sushi.cache-path', storage_path('framework/cache')));
$cachePath = $cacheDirectory . '/' . $cacheFileName;
$cachePath = $cacheDirectory.'/'.$cacheFileName;
$modelPath = (new \ReflectionClass(static::class))->getFileName();

$states = [
Expand Down Expand Up @@ -75,7 +74,7 @@ public function migrate()
$firstRow = $rows[0];
$tableName = $this->getTable();

throw_unless($rows, new \Exception('Sushi: $rows property not found on model: ' . get_class($this)));
throw_unless($rows, new \Exception('Sushi: $rows property not found on model: '.get_class($this)));

static::resolveConnection()->getSchemaBuilder()->create($tableName, function ($table) use ($firstRow) {
foreach ($firstRow as $column => $value) {
Expand All @@ -92,5 +91,4 @@ public function migrate()

static::insert($rows);
}

}