Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

angerfist's avatar

admin panel

Hello everyone, tell me or show me how to implement my own admin panel for a site on Laravel?

0 likes
12 replies
angerfist's avatar

@benjamin1509 when creating an admin, it gives the following

php artisan make:filament-user

 Name:
 > admin

 Email address:
 > [email protected]

 Password:
 >


   UnexpectedValueException

  The stream or file "/home/sites/sumsi/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: The stream or file "/home/sites/sumsi/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: Add [name] to fillable property to allow mass assignment on [App\Models\User].
Context: {"exception":{}}
Context: {"exception":{}}

  at vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:146
    142▕             restore_error_handler();
    143▕             if (!is_resource($stream)) {
    144▕                 $this->stream = null;
    145▕
  ➜ 146▕                 throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened in append mode: '.$this->errorMessage, $url) . Utils::getRecordMessageForException($record));
    147▕             }
    148▕             stream_set_chunk_size($stream, $this->streamChunkSize);
    149▕             $this->stream = $stream;
    150▕         }

      +10 vendor frames
  11  [internal]:0
      Illuminate\Foundation\Bootstrap\HandleExceptions::Illuminate\Foundation\Bootstrap\{closure}()

my model User.php

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    use HasFactory;
}
NoLAstNamE's avatar

@angerfist Try this if it will solve your problem.

chmod -R 777 /path/to/sumsi/storage/logs/laravel.log

or

chmod -R 777 /path/to/sumsi/storage/logs

or

sudo chmod -R 777 /path/to/sumsi/storage/logs/laravel.log
angerfist's avatar

@benjamin1509 my model User.php

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{

    use HasFactory;
}
NoLAstNamE's avatar

@angerfist

Add your other columns inside the $fillable.

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    protected $fillable = ['name', ....];
}
angerfist's avatar

@benjamin1509 create model User.php

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    protected $fillable = ['name','slug'];
    /*use HasFactory;*/
}

made a migration, then gave the command php artisan make:filament-user

after that gives

 Illuminate\Database\QueryException

  SQLSTATE[HY000]: General error: 1364 Field 'email' doesn't have a default value (SQL: insert into `users` (`name`, `updated_at`, `created_at`) values (ado, 2022-10-31 08:44:50, 2022-10-31 08:44:50))
angerfist's avatar

@Sinnbeck no work

Filament\Commands\MakeUserCommand::createUser(): Return value must be of type Illuminate\Contracts\Auth\Authenticatable, App\Models\User returned

  at vendor/filament/filament/src/Commands/MakeUserCommand.php:33
     29▕     }
     30▕
     31▕     protected function createUser(): Authenticatable
     32▕     {
  ➜  33▕         return static::getUserModel()::create($this->getUserData());
     34▕     }
     35▕
     36▕     protected function sendSuccessMessage(Authenticatable $user): void
     37▕     {

      +14 vendor frames
  15  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

model User.php

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    protected $fillable = [
        'name',
        'slug',
        'email',
        'password'];
    use HasFactory;
}

Please or to participate in this conversation.