negro
negro
Explore posts from servers
FFilament
Created by negro on 6/29/2024 in #❓┊help
Custom page
I have a list of students, and i want to filter this list by classroom
5 replies
FFilament
Created by negro on 6/23/2024 in #❓┊help
Edit Action
it works
9 replies
FFilament
Created by negro on 6/23/2024 in #❓┊help
Edit Action
thanks you
9 replies
FFilament
Created by negro on 6/23/2024 in #❓┊help
Edit Action
I have a toggle field in my form the default value is false and only display on edit. If you set this value to true I don't want to edit the form again
9 replies
FFilament
Created by negro on 6/23/2024 in #❓┊help
Edit Action
It's not what I need
9 replies
FFilament
Created by negro on 6/4/2024 in #❓┊help
Filament Menu
i got a livewire component and i wish to render filament default layout to livewire component wiew
4 replies
FFilament
Created by zenepay on 5/28/2024 in #❓┊help
Livewire modal does not pop to top layer
Please can you share your Livewire component ?? It could helps me for another problem
5 replies
FFilament
Created by negro on 5/14/2024 in #❓┊help
filament many to many
19 replies
FFilament
Created by negro on 5/14/2024 in #❓┊help
filament many to many
<?php

namespace App\Models;

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

class Student extends Model
{
use HasFactory, softDeletes;

protected $fillable = [
'matricule',
'fname',
'lname',
'sexe',
'father_name',
'mother_name',
'fphone',
'mphone',
'born_at',
'born_place',
'allergy',
'logo',
'description',
'quarter'
];

protected $dates = [ 'deleted_at' ];

protected $casts = [
'created_at' => 'datetime:Y-m-d',
];

public function classrooms() {
return $this->belongsToMany(Classroom::class)->withPivot('academic_id');
}

public function notes() {
return $this->hasMany(Note::class);
}

}
<?php

namespace App\Models;

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

class Student extends Model
{
use HasFactory, softDeletes;

protected $fillable = [
'matricule',
'fname',
'lname',
'sexe',
'father_name',
'mother_name',
'fphone',
'mphone',
'born_at',
'born_place',
'allergy',
'logo',
'description',
'quarter'
];

protected $dates = [ 'deleted_at' ];

protected $casts = [
'created_at' => 'datetime:Y-m-d',
];

public function classrooms() {
return $this->belongsToMany(Classroom::class)->withPivot('academic_id');
}

public function notes() {
return $this->hasMany(Note::class);
}

}
<?php

namespace App\Models;

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

class Classroom extends Model
{
use HasFactory, SoftDeletes;

protected $fillable = [
'building_id',
'group_id',
'user_id',
'name',
'description',
];

protected $casts = [
'created_at' => 'datetime:Y-m-d',
];

public function building() {
return $this->belongsTo(Building::class);
}

public function group() {
return $this->belongsTo(Group::class);
}

public function students() {
return $this->belongsToMany(Student::class,)->withPivot('academic_id');
}

public function notes() {
return $this->hasMany(Note::class);
}

public function user() {
return $this->belongsTo(User::class);
}
}
<?php

namespace App\Models;

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

class Classroom extends Model
{
use HasFactory, SoftDeletes;

protected $fillable = [
'building_id',
'group_id',
'user_id',
'name',
'description',
];

protected $casts = [
'created_at' => 'datetime:Y-m-d',
];

public function building() {
return $this->belongsTo(Building::class);
}

public function group() {
return $this->belongsTo(Group::class);
}

public function students() {
return $this->belongsToMany(Student::class,)->withPivot('academic_id');
}

public function notes() {
return $this->hasMany(Note::class);
}

public function user() {
return $this->belongsTo(User::class);
}
}
my models
19 replies
FFilament
Created by negro on 5/14/2024 in #❓┊help
filament many to many
public function up(): void
{
Schema::create('classrooms', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->foreignId('building_id')->contrained();
$table->foreignId('group_id')->contrained();
$table->foreignId('user_id')->contrained();
$table->text('description');
$table->timestamps();
$table->softDeletes();
});
}
public function up(): void
{
Schema::create('classrooms', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->foreignId('building_id')->contrained();
$table->foreignId('group_id')->contrained();
$table->foreignId('user_id')->contrained();
$table->text('description');
$table->timestamps();
$table->softDeletes();
});
}
public function up(): void
{
Schema::create('students', function (Blueprint $table) {
$table->id();
$table->string('matricule');
$table->string('fname');
$table->string('lname')->nullable();
$table->string('sexe');
$table->string('born_place')->nullable();
$table->string('father_name')->nullable();
$table->string('mother_name');
$table->string('fphone')->nullable();
$table->string('mphone');
$table->date('born_at');
$table->text('allergy')->nullable();
$table->string('logo')->default('anonymous.png');
$table->text('description')->nullable();
$table->string('quarter')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
public function up(): void
{
Schema::create('students', function (Blueprint $table) {
$table->id();
$table->string('matricule');
$table->string('fname');
$table->string('lname')->nullable();
$table->string('sexe');
$table->string('born_place')->nullable();
$table->string('father_name')->nullable();
$table->string('mother_name');
$table->string('fphone')->nullable();
$table->string('mphone');
$table->date('born_at');
$table->text('allergy')->nullable();
$table->string('logo')->default('anonymous.png');
$table->text('description')->nullable();
$table->string('quarter')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
public function up(): void
{
Schema::create('classroom_student', function (Blueprint $table) {
$table->id();
$table->foreignId('student_id')->contrained();
$table->foreignId('classroom_id')->contrained();
$table->foreignId('academic_id')->contrained();
$table->timestamps();
});
}
public function up(): void
{
Schema::create('classroom_student', function (Blueprint $table) {
$table->id();
$table->foreignId('student_id')->contrained();
$table->foreignId('classroom_id')->contrained();
$table->foreignId('academic_id')->contrained();
$table->timestamps();
});
}
my migrations
19 replies
FFilament
Created by negro on 5/14/2024 in #❓┊help
filament many to many
and this class CreateStudent extends CreateRecord { protected static string $resource = StudentResource::class; protected function mutateFormDataBeforeCreate(array $data): array { $data['matricule'] = '122'; $data['academic_id'] = 12; return $data; } }
19 replies
FFilament
Created by negro on 5/14/2024 in #❓┊help
filament many to many
student resource form public static function form(Form $form): Form { return $form ->schema([ Forms\Components\Section::make('Information Personnel Apprenant') ->schema([ Forms\Components\TextInput::make('fname') ->label('Nom') ->autofocus() ->required() ->maxLength(255) ->autocapitalize(), Forms\Components\TextInput::make('lname') ->label('Prenom') ->maxLength(255) ->autocapitalize(), Forms\Components\Radio::make('sexe') ->options([ 1 => 'Homme', 0 => 'Femme', ]) ->boolean() ->inline() ->default(1) ->required(), Forms\Components\DatePicker::make('born_at') ->label('Date de Naissance') ->required(), Forms\Components\TextInput::make('born_place') ->label('Lieu de naissance') ->required() ->maxLength(255), Forms\Components\TextInput::make('quarter') ->label('Quartier Habitation') ->maxLength(255) ->required() ]) ->columns(2), ]); }
19 replies
FFilament
Created by negro on 5/14/2024 in #❓┊help
filament many to many
function in my student model: public function classrooms() { return $this->belongsToMany(Classroom::class)->withPivot('academic_id'); } function in my classroom model: public function students() { return $this->belongsToMany(Student::class,)->withPivot('academic_id'); }
19 replies
FFilament
Created by negro on 5/14/2024 in #❓┊help
filament many to many
in this relation classroom_student, academic_id is an additional field
19 replies
FFilament
Created by negro on 5/14/2024 in #❓┊help
filament many to many
SQLSTATE[HY000]: General error: 1364 Field 'academic_id' doesn't have a default value
19 replies
FFilament
Created by negro on 5/14/2024 in #❓┊help
filament many to many
this is the error i get: insert into classroom_student (classroom_id, student_id) values (1, 1)
19 replies
FFilament
Created by negro on 5/14/2024 in #❓┊help
filament many to many
i whish to know how i can field academic_id who is addition field in these relation
19 replies
FFilament
Created by negro on 5/14/2024 in #❓┊help
filament many to many
i have two models Student and Classroom link with many to many. i have a table with classroom_id, student_id and one additional field(academic_id). hope it's more readable
19 replies