4 years ago

__contruct Method Laravel 5 not work

Posted 4 years ago by WashingtonIshioLopes

Please, someone can me help ? I am user Laravel beginner. I saw a intenet video tutorial showing edit method to Controller. Follow code:

namespace igreja_app\Model;

use Illuminate\Database\Eloquent\Model;

class DataUser extends Model { protected $table = 'usuarios'; protected $primaryKey = 'id_usuario'; protected $guarded = array('id_usuario'); }

class UsuarioController extends Controller{

public function postEdit($user_id){

    $user= DataUser::find($user_id);
    $dataForm = Request::all();
    $user->__construct($dataForm );  // ERROR 
    return Redirect::to('user');    


But to Laravel 5 not work. ERROR - Call to a member function __construct() on a non-object What do I have do to fix this problem ? Thanks Washington

Please sign in or create an account to participate in this conversation.