-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow configuration for
reacts_model
and reacts_id_column
- Loading branch information
Showing
10 changed files
with
328 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Qirolab\Laravel\Reactions; | ||
|
||
class Helper | ||
{ | ||
/** | ||
* Retrieve User's model class name. | ||
* | ||
* @return string | ||
*/ | ||
public static function resolveReactsModel() | ||
{ | ||
$userModel = config('reactions.reacts_model'); | ||
if ($userModel) { | ||
return $userModel; | ||
} | ||
|
||
return config('auth.providers.users.model'); | ||
} | ||
|
||
/** | ||
* Retrieve User's model column name in reactions table. | ||
* | ||
* @return string | ||
*/ | ||
public static function resolveReactsIdColumn() | ||
{ | ||
$userModel = config('reactions.reacts_id_column'); | ||
if ($userModel) { | ||
return $userModel; | ||
} | ||
|
||
return 'user_id'; | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Qirolab\Tests\Laravel\Reactions\Stubs\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Qirolab\Laravel\Reactions\Contracts\ReactsInterface; | ||
use Qirolab\Laravel\Reactions\Traits\Reacts; | ||
|
||
class Profile extends Model implements ReactsInterface | ||
{ | ||
use Reacts; | ||
|
||
/** | ||
* The table associated with the model. | ||
* | ||
* @var string | ||
*/ | ||
protected $table = 'users'; | ||
|
||
/** | ||
* The attributes that are mass assignable. | ||
* | ||
* @var array | ||
*/ | ||
protected $fillable = [ | ||
'name', | ||
]; | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.