Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [Laravel]Baza danych
Puchatek320
post 24.05.2020, 16:19:15
Post #1





Grupa: Zarejestrowani
Postów: 68
Pomógł: 0
Dołączył: 4.11.2019

Ostrzeżenie: (0%)
-----


Cześć,
mam problem z użyciem tabeli laravel wql nie może jej powiązać z tabelą za pomocą use App\tags;

do rzeczy mam 5 tabeli i 2 z nich laravel wql ich nie może powiązać

"Error
Class 'App\tags' not found "


  1. Controller
  2.  
  3. <?php
  4.  
  5. namespace App\Http\Controllers;
  6.  
  7. use Illuminate\Http\Request;
  8.  
  9. use Illuminate\Support\Facades\DB;
  10.  
  11. use Illuminate\Support\Facades\Storage;
  12.  
  13. use App\films;
  14.  
  15. use App\tags;
  16.  
  17. class AdminController extends Controller
  18. {
  19. public function save_tags(Request $request){
  20.  
  21. $thumbnail = $request -> input('thumbnail_tags');
  22. $name = $request -> input('tags_name');
  23.  
  24. $save_thumbnail = Storage::disk('thumbnail_tags')->url(''.$thumbnail.''); //save file from form
  25.  
  26. $tags = new tags;
  27.  
  28. $tags->name = $name;
  29. $tags->thumbnail = $save_thumbnail;
  30. $tags->save();
  31. }
  32. }
  33. Migracja
  34.  
  35. <?php
  36.  
  37. use Illuminate\Database\Migrations\Migration;
  38. use Illuminate\Database\Schema\Blueprint;
  39. use Illuminate\Support\Facades\Schema;
  40.  
  41. class Tags extends Migration
  42. {
  43. /**
  44.   * Run the migrations.
  45.   *
  46.   * @return void
  47.   */
  48. public function up()
  49. {
  50. Schema::create('tags', function (Blueprint $table) {
  51. $table->id();
  52. $table->integer('name');
  53. $table->integer('thumbnail');
  54. $table->timestamp('created_at')->nullable();
  55. $table->timestamp('updated_at')->nullable();
  56.  
  57. });
  58. }
  59.  
  60. /**
  61.   * Reverse the migrations.
  62.   *
  63.   * @return void
  64.   */
  65. public function down()
  66. {
  67. //
  68. }
  69. }
  70.  
  71.  
  72.  
  73.  

Nie rozumiem o co chodzi Google też mało mówi może miał ktoś podobny przypadek i wie w czym leży problem?

Ten post edytował Puchatek320 24.05.2020, 16:20:33
Go to the top of the page
+Quote Post
viking
post 24.05.2020, 16:30:46
Post #2





Grupa: Zarejestrowani
Postów: 6 365
Pomógł: 1114
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


A czego nie rozumiesz w komunikacie Class 'App\tags' not found? Nie masz takiej klasy. Pewnie jej nawet nie stworzyłeś. Stosuj się do poprawnego nazewnictwa. Nazwy zaczynaj z dużych liter.


--------------------
Go to the top of the page
+Quote Post
Puchatek320
post 24.05.2020, 16:55:58
Post #3





Grupa: Zarejestrowani
Postów: 68
Pomógł: 0
Dołączył: 4.11.2019

Ostrzeżenie: (0%)
-----


myślałem że te klasy tworzą się automatycznie przy tworzeniu migracji. Pierwszy raz napotykam się na takim problem. Gdzie i w jaki sposób tworzy się klasy dla bazy danych?
Go to the top of the page
+Quote Post
viking
post 24.05.2020, 18:35:15
Post #4





Grupa: Zarejestrowani
Postów: 6 365
Pomógł: 1114
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


Migracje tworzą tabele. Tak, możesz w lv od razu stworzyć plik modelu i jest to opisane w dokumentacji.


--------------------
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 25.04.2024 - 06:31