Jump to content

ali_254

Members
  • Posts

    97
  • Joined

  • Last visited

Everything posted by ali_254

  1. hi... i want create Validation form in laravel.... when run project , receive this error: The GET method is not supported for this route. Supported methods: POST. html form: <form action="/test2" method="post"> {{csrf_field()}} <input type="text" name="title" id="title"> <br> <input type="text" name="title2" id="title2"> <br> <input type="text" name="title3" id="title3"> <input type="submit" value="register"> </form> route: Route::post('/test2', [Homecontroller::class, 'index3']); Homecontroller.php: public function index3(Request $request){ $a=$request->post("title"); echo $a . "</br>"; $a2=$request->post("title2"); echo $a2 . "</br>"; $a3=$request->post("title3"); echo $a3 . "</br>"; $validated = $request->validate([ 'title' => 'required', 'title2' => 'required', ]); return view('test2'); } please guide me.thanks
  2. hi.. i follow this page for create user login: laravel-8-authentication-tutorial i run this code: npm install but i Received this error: error 'npm' is not recognized as an internal or external command, operable program or batch file. whats problem? please help
  3. i found problem.. problem is from version of php , i Upgrade version and install laraval 8 with success
  4. i also inter this code: composer create project laravel/laravel test 8.0 but , result is: [InvalidArgumentException] Could not find package laravel/laravel with version 8.0 in a version installable using your PHP version, PHP extens ions and Composer version. PHP Version is 7.4.9 whats problem? thanks
  5. hi... i install last version of composer and inter this code for install laravel: composer create-project --prefer-dist laravel/laravel blog Laravel is successfully installed but when inter code "php artsisan --version" in terminal , result is version 5 !!! i need to install laravel version 8 , whats problem? thanks
  6. ok thanks , but i have a problem.. i add this code in controller but variable $data1 in file blade.php Cannot be identified class FlightController extends Controller { public function function1(Request $request,$id ){ $data1=Flight::find($id); return view('audi')->with('id',$id)->with('a',$data1); } } error: (2/2) ErrorException Undefined variable: data1 (View: C:\wamp64\www\Amozesh_php\shoplaravel\resources\views\audi.blade.php) file blade.php: @extends('layout.master') @section('content') <h2>ali niknami</h2> @endsection {{ $data1 }} <form action="/users/insert" method="post"> {{csrf_field()}} <input type="text" name="title" id="title"> <br> <input type="text" name="title2" id="title2"> <br> <input type="text" name="title3" id="title3"> <input type="submit" value="register"> </form>
  7. hi... i create two table in laravel and I created a "join" operation between them. controller file: class FlightController extends Controller { public function function1(Request $request,$id ){ $data1=Flight::find($id); $a=$data1->FlightComment(); dd($a); return view('audi')->with('id',$id)->with('a',$a); } } Variable "A" is an array, how can I display it in file "blade.php"? thanks Flight table: FlightComment:
  8. thanks , but i delete all table in phpmyadmin and Reinstall the code "php artisan migrate" , Problem solved, thanks a lot
  9. no , only in table flights
  10. hi ... I made a table called: flights , Also, I want to create another table and run the "join" operation between them. this table called: flight_comments table flights: public function up() { Schema::create('flights', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name'); $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); table flight_comments: public function up() { Schema::create('flight_comments', function (Blueprint $table) { $table->bigIncrements('id'); $table->bigInteger('flight_id')->unsigned(); $table->string('body','140'); $table->nullabletimestamps(); $table->foreign('flight_id')->references('id')->on('flights')->onDelete('cascade'); }); } When I run the "migration" command, I get the following error: In Connection.php line 647: SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table `flight_comments` add constraint `flight_ comments_flight_id_foreign` foreign key (`flight_id`) references `flights` (`id`) on delete cascade) In Connection.php line 449: SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint please guide me
  11. thanks... i edit code . The problem was solved.. $data1=Motorolla::find(1);
  12. hi... i create model of eloquent end create table.... in file controller , i add this code but return null😪 public function index2(Request $request,$id){ $data1=Motorolla::find($request['1']); dd($data1); return view('audi')->with('id',$id)->with('data1',$data1); } file web.php: Route::get('/audi/{id}','HomeController@index2' ); table motorolla: public function up() { Schema::create('motorollas', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name'); $table->string('address'); $table->string('password'); $table->timestamps(); });
  13. Unfortunately I did not understand, what is the problem?
  14. thanks , yes! file Ultimate.php: <?php namespace App; use Illuminate\Database\Eloquent\Model; class Ultimate extends Model { // }
  15. hi... I want to show the tables with Eloquent. i create one model in folder "app" and create migratione . in file controller add this codes : <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use app\Ultimate; class HomeController extends Controller { // public function index2(Request $request,$id){ $data1=Ultimate::all(); dd($data1); return view('users')->with('id',$id); } } But at runtime, an error occurs. error : (1/1) FatalErrorException Class 'app\Ultimate' not found in HomeController.php line 19 whats problem? thanks
  16. I found a solution for this problem... change table engine to=InnoDB
  17. thank you. Is there a solution information when entering the bank Be sorted? Without change in "query" codes? In fact, any data that enters the table , Must be at the bottom or top of the table....Eventually, the problem is solved
  18. thanks mr Barand. are you can edit my cod AND add your Suggested code? $sql = "SELECT *,news.id as nid FROM news left JOIN category ON category.id=news.catid LIMIT $lim OFFSET $offset ";
  19. $sql = "SELECT *,news.id as nid FROM news left JOIN category ON category.id=news.catid LIMIT $lim OFFSET $offset ";
  20. thank you. When I add a query And display it in a grid , Unfortunately The information is not displayed correctly again... Actually , Information when added not stored properly...Is there a solution to this problem? Or should the "query" solve the problem? Do you have an example and source code for this?
  21. hi... i have a table ... i add and remove data in the table...when i add new record , information add to center of the table ! whats problem? i want add data in first of table. please guide me.thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.