i cant't use package in the pyrocms ?
Created 7 years ago by mohammed_abdallah

i added https://packagist.org/packages/rtconner/laravel-likeable to my composer json all goes right but when am using the trait in the module model it's said that the trait not found , i think that there's namespace missing and advice and that my model <?php namespace Anomaly\ChampionshipsModule\Player;

use Anomaly\ChampionshipsModule\Player\Contract\PlayerInterface; use Anomaly\Streams\Platform\Model\Championships\ChampionshipsPlayersEntryModel;

class PlayerModel extends ChampionshipsPlayersEntryModel implements PlayerInterface { use \Conner\Likeable\Likeable; }

ryanthompson  —  7 years ago

Hi there! The use \Conner\Likeable\Likeable; statement should go up above the class with the others.

mohammed_abdallah  —  7 years ago

u may right but in the documentation declare in the way which i posted so when i moved it up work fine but am can't access any function

as this $player = PlayerModel::find($player_id); $result = $player->like(); it say that (undefined like function) take in consideration that (\Conner\Likeable\Likeable) is trait

fryiee  —  7 years ago

You need to do both. A trait needs to be added to the use section above the class, then you actually need to signal that you are using that trait in the class as well. Example:

<?php
use Conner\Likeable\Likeable;

class SomeClass {

use Likeable;

// your functions here
}