carlek

Experience

300

0 Best Reply Awards

  • Member Since 4 Months Ago
  • 0 Lessons Completed
  • 0 Favorites

10th May, 2017

carlek left a reply on Redirection To Different Views • 3 months ago

@bunnypro

My little big mistake,now works. Thanks

9th May, 2017

carlek started a new conversation Redirection To Different Views • 3 months ago

Hello, I have only User table in my database with column position(employer,worker,accountant). I want to make redirection to different view by depending on the field in the database. I try to do this, in my controller:

public function index()
    {
        if (Auth::User()->position = "employer") {
            return view('adminpanel.admindashboard');
        }
        elseif(Auth::User()->postion = "worker")
        {
            return view('welcome');
        }
    }

But it always redirect me to adminpanel.admindashboard. Can You help me?

24th April, 2017

carlek left a reply on Forgot Your Password Doesn't Work • 3 months ago

@Snapey No i didnt remove this from .env

carlek left a reply on Forgot Your Password Doesn't Work • 3 months ago

I'm sorry that I write so late, but I was away. Yes i change it and configurated all :

  'driver' => env('MAIL_DRIVER', 'smtp'),
    'host' => env('MAIL_HOST', 'smtp.wp.pl'),
    'port' => env('MAIL_PORT', '465'),
    'from' => ['address' => 'wujekmirek98@wp.pl', 'name' => 'karol'],
    'encryption' => env('MAIL_ENCRYPTION','ssl'),
    'username' => env('MAIL_USERNAME', '####'),
    'password' => env('MAIL_PASSWORD', '####'),
    'sendmail' => '/usr/sbin/sendmail -bs',

    'pretend' => false,

];

20th April, 2017

carlek left a reply on Laravel 5.4MassAssignmentException In Model.php Line 225: _token • 3 months ago

@mdecooman

Yes, I fixed it with you. You are great! Thanks :)

carlek started a new conversation Forgot Your Password Doesn't Work • 3 months ago

Hello,

I have problem with standart option from auth which is 'Forgot Your Password', which is installed automatically with auth. I give the correct e-mail, after a while I get the information from the message was sent but in the mailbox it does not have. What could be wrong?

18th April, 2017

carlek left a reply on Laravel 5.4MassAssignmentException In Model.php Line 225: _token • 4 months ago

@jekinney I know now, but after delete this nothing has changed. @mdecooman It looks better now : QueryException in Connection.php line 647: SQLSTATE[HY000]: General error: 1364 Field 'password' doesn't have a default value (SQL: insert into users (nameandsurname, PESEL, adress, position, email, leavesdays, updated_at, created_at) values (sdadas, dadsa, adsadsa, dsadsaads, dssadsadas, dsadsadsa, 2017-04-18 21:26:58, 2017-04-18 21:26:58))

carlek left a reply on Laravel 5.4MassAssignmentException In Model.php Line 225: _token • 4 months ago

@mdecooman The same when i comment my @fillable : MassAssignmentException in Model.php line 225: _token

What do You mean at this sentence : "can you copy/paste here the use statements of your controller?". Sorry, my english is so bad :( Do you want me to copy all lines of the controller?

carlek left a reply on Laravel 5.4MassAssignmentException In Model.php Line 225: _token • 4 months ago

@mdecooman

FatalThrowableError in Builder.php line 732: Type error: Argument 1 passed to Illuminate\Database\Eloquent\Builder::create() must be of the type array, null given, called in C:\Users\sekre\urlopy\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php on line 1329

carlek left a reply on Laravel 5.4MassAssignmentException In Model.php Line 225: _token • 4 months ago

@mdecooman

FatalThrowableError in HomeController.php line 39: Call to a member function offsetUnset() on array

carlek left a reply on Laravel 5.4MassAssignmentException In Model.php Line 225: _token • 4 months ago

@jbowman99

array:9 [▼ "_token" => "bWf3WcdXGY2uDqx5z9vBVO5Fg3MuBHG2BPXQFth4" "nameandsurname" => "sdadsa" "PESEL" => "dsadas" "adress" => "dsadsa" "position" => "saddsadsa" "email" => "sdadsa" "leavesdays" => "adsdsadsadsa" "password" => null "remember_token" => null ]

carlek left a reply on Laravel 5.4MassAssignmentException In Model.php Line 225: _token • 4 months ago

@jbowman99 I tried it, That didnt solve the problem.

carlek started a new conversation Laravel 5.4MassAssignmentException In Model.php Line 225: _token • 4 months ago

I was making a system wherein only administrator can adding users. I have a problem, becouse after filling the form I receives error who looks like : MassAssignmentException in Model.php line 225: _token

My Form:

           {!! Form::open(['url'=>'adminpanel/adduser/store','class'=>'form-horizontal']) !!}
            <div class="form-group">
                <div class="col-md-4 control-label">
                    {!! Form::label('nameandsurname','imie i nazwisko:') !!}
                </div>
                <div class="col-md-6">
                    {!! Form::text('nameandsurname', null, ['class' => 'form-control']) !!}
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-4 control-label">
                    {!! Form::label('PESEL','PESEL:') !!}
                </div>
                <div class="col-md-6">
                    {!! Form::text('PESEL',null,['class'=>'form-control']) !!}
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-4 control-label">
                    {!! Form::label('adress','adres:') !!}
                </div>
                <div class="col-md-6">
                    {!! Form::text('adress',null,['class'=>'form-control']) !!}
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-4 control-label">
                    {!! Form::label('position','stanowisko:') !!}
                </div>
                <div class="col-md-6">
                    {!! Form::text('position',null,['class'=>'form-control']) !!}
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-4 control-label">
                    {!! Form::label('email','email:') !!}
                </div>
                <div class="col-md-6">
                    {!! Form::text('email',null,['class'=>'form-control']) !!}
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-4 control-label">
                    {!! Form::label('leavesdays','liczbadniwolnych:') !!}
                </div>
                <div class="col-md-6">
                    {!! Form::text('leavesdays',null,['class'=>'form-control']) !!}
                </div>
            </div>


            {!! Form::hidden('password', null) !!}
            {!! Form::hidden('remember_token',null) !!}

This is User Model :

        use Notifiable;

/**

  • The attributes that are mass assignable.
  • @var array */

protected $fillable = [ 'nameandsurname', 'email','PESEL','adress','position','leavesdays',

]; protected $table = 'users'; /**

  • The attributes that should be hidden for arrays.

  • @var array */ protected $hidden = [ 'password', 'remember_token', ]; Request in controller :

        public function store(AddUserRequest $request)
        {
       //        User::create($request->except('_token'));
    

    $newUser = User::create($request->all()); $newUser->save();

    return redirect('/adminpanel/admindashboard'); } Migration:

    public function up() { Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('nameandsurname',40); $table->string('PESEL',9); $table->string('adress',30); $table->enum('position',array('employer','worker','accountant')); $table->string('email',100)->unique(); $table->string('password'); $table->integer('leavesdays'); $table->rememberToken(); $table->timestamps(); }); }

I was looking for this problem on the internet, but any suggestion helped me.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.