ali_254
-
Posts
97 -
Joined
-
Last visited
Posts posted by ali_254
-
-
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
-
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
-
3 hours ago, requinix said:
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:
-
2 minutes ago, Barand said:
That was intended as a hint.
Make them both the same and you should then be able to create your foreign key.
thanks , but i delete all table in phpmyadmin and Reinstall the code "php artisan migrate" , Problem solved, thanks a lot
-
1 hour ago, Barand said:
Is the column UNSIGNED in both tables?
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
-
10 minutes ago, requinix said:
What is $request[1] supposed to be? Don't you mean $id?
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(); });
-
2 minutes ago, requinix said:
Oh.
use app\Ultimate;
Look closely.
Unfortunately I did not understand, what is the problem?
-
-
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
-
I found a solution for this problem...
change table engine to=InnoDB
-
43 minutes ago, kicken said:
Databases don't have a concept of order when inserting data. The data is stored in whatever location it will fit.
You can only define an order when you're reading data back out of the database using a SELECT query and you do that by using an ORDER BY clause in your query.
So if you want your data to display in a specific order, you MUST change your query to include an ORDER BY clause that specifies the ordering you want.
thank you
-
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
-
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 ";
-
$sql = "SELECT *,news.id as nid FROM news left JOIN category ON category.id=news.catid LIMIT $lim OFFSET $offset ";
-
2 hours ago, kicken said:
It doesn't matter where in the table the data is stored. When you query your data you want to specify an ORDER BY clause to define what order it will be returned in.
If you want the records to display in the order the were added, make sure you have a field that records what date and time the record was added and sort by that field.
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?
Quotemake sure you have a field that records what date and time the record was added and sort by that field.
Do you have an example and source code for this?
-
error The GET method is not supported for this route. Supported methods: POST
in Frameworks
Posted
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:
route:
Homecontroller.php:
please guide me.thanks