ali_254
Members-
Posts
97 -
Joined
-
Last visited
Everything posted by ali_254
-
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
-
i found problem.. problem is from version of php , i Upgrade version and install laraval 8 with success
-
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
-
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
-
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>
-
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:
-
migration: error 1215 Cannot add foreign key constraint
ali_254 replied to ali_254's topic in Frameworks
thanks , but i delete all table in phpmyadmin and Reinstall the code "php artisan migrate" , Problem solved, thanks a lot -
migration: error 1215 Cannot add foreign key constraint
ali_254 replied to ali_254's topic in Frameworks
no , only in table flights -
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
-
thanks... i edit code . The problem was solved.. $data1=Motorolla::find(1);
-
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(); });
-
Unfortunately I did not understand, what is the problem?
-
thanks , yes! file Ultimate.php: <?php namespace App; use Illuminate\Database\Eloquent\Model; class Ultimate extends Model { // }
-
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
-
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?