Ich möchte Zeichen und Zahlen für die Spalte speichern haben Primärschlüssel in der Datenbank.Datentyp für Zeichen und Zahlen in Laravel
habe ich die Tabelle durch Abfrage in Laravel wie diese
public function up()
{
Schema::create('students', function (Blueprint $table) {
// $table->increments('id');
$table->engine = 'InnoDB';
$table->string('roll_no');
$table->string('name');
$table->string('father_name');
$table->string('address');
$table->string('cnic')->unique();
$table->string('phone_no');
$table->string('father_phone_no');
$table->string('email')->unique();
$table->string('password');
$table->string('dept_id');
$table->rememberToken();
$table->timestamps();
$table->primary('roll_no');
$table->foreign('dept_id')->references('dept_id')->on('departments')->onDelete('cascade');
});
}
und meine Spalte Datentyp String gesetzt. was zeigt, dass varchar in der Datenbank gut aussieht. Wenn ich Werte in Form gebe die Daten perfekt wie 12abc aber wenn ich Daten aus der Datenbank abrufen, zeigt es nur ohne Zeichen. und die Funktion ist
public function showStudents()
{
$allStudents = Student::all();
// $user = Auth::user();
return view ('admin.students.showStudents', compact('allStudents'));
}
und Schleife ist
@foreach($allStudents as $student)
<tr>
<th scope="row">{{ $student->roll_no }}</th>
<td><a href="{{ action('[email protected]', [$student->roll_no])}}">{{ $student->name }}</a></td>
<td>{{ $student->address }}</td>
<td>{{ $student->phone_no }}</td>
<td>{{ $student->email }}</td>
<td>{{ $student->dept_id }}</td>
<td><a href="{{ action('[email protected]', [$student->roll_no])}}" class="edit">Edit</a> <a href="{{ action('[email protected]', [$student->roll_no])}}" class="delete">Delete</a> </td>
</tr>
@endforeach``
Was soll ich die richtige und vollständige Daten erhalten tun. Danke im Voraus.
für welche Spalte haben Sie ein Problem? –