I have set in my model a custom primary key as:
protected $primaryKey = 'id_player';
It is set as the primary key on MySql
But If I do a
$rows = DB::table("players")->find($playerId);
It returns no items (but it exists).
Players Model
namespace App;
use Illuminate\Database\Eloquent\Model;
class Players extends Model{
protected $primaryKey = 'id_player';
}
PlayersController
namespace App\Http\Controllers\Players;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Players;
use Illuminate\Support\Facades\DB;
class PlayersController extends Controller{
...
...
}
I'm new on Laravel, what I'm missing?