laravel

Undefined variable: post (View: /home/e/Images/123/test1/resources/views/post.blade.php) [duplicate]

﹥>﹥吖頭↗ 提交于 2021-02-17 07:15:08
问题 This question already has answers here : “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP (28 answers) Closed 4 months ago . I was created post create is it work. I try to adding for can edit post and delete, but i have error undefined variable. namespace App\Http\Controllers; use App\Models\Category; use App\Models\Post; use App\Models\PostImage; use Illuminate\Http\Request; class PostController extends Controller { public function __construct

How to send a variable from JS to my Laravel Controller

做~自己de王妃 提交于 2021-02-17 07:04:11
问题 I'm sorry. I have researched for several hours, several and I still do not reach success with this. Let me explain: I'm on the route /events/1 , so I'm already inside the details of the event. When I select a date (that is why it is the variable "day_id") it makes a query. But each event has different days, that is why I need to pass the event ID also to make the query. $event_id = "Dynamic Value"; $data = Hour::where('selected_date', $day_id)->where('event_id', $event_id)->get(); I don't

How to send a variable from JS to my Laravel Controller

自古美人都是妖i 提交于 2021-02-17 07:04:10
问题 I'm sorry. I have researched for several hours, several and I still do not reach success with this. Let me explain: I'm on the route /events/1 , so I'm already inside the details of the event. When I select a date (that is why it is the variable "day_id") it makes a query. But each event has different days, that is why I need to pass the event ID also to make the query. $event_id = "Dynamic Value"; $data = Hour::where('selected_date', $day_id)->where('event_id', $event_id)->get(); I don't

How to get data from parent and child table on the basis of status where foreign key have different status for every row

此生再无相见时 提交于 2021-02-17 06:52:18
问题 I have 2 tables with foreign key relationship. Situation is I have a case and a case have many revision s and every revision have its own status . I want to get parent table data and child data if only specific row of foreign key table status is changed Table Case id case_no patient_name age 1 12564 abc 78 2 1256 lkj 63 3 125 bdhf 23 Table Case_Revisons id case_id revison status 1 1 0 assesemnt 2 1 1 assesment 3 1 2 treatment 4 2 2 assesment 5 3 1 assesment What I want is all data all data

Using @error directive to target the previous input field from multiple input fields after submit in Laravel 5.8

隐身守侯 提交于 2021-02-17 06:46:24
问题 The new @error directive was introduced in Laravel 5.8.13. So, instead of doing this: // old @if ($errors->has('email')) <span>{{ $errors->first('email') }}</span> @endif You can now do this // new @error('email') <span>{{ $message }}</span> @enderror However, I'm having issues trying to target only the input fields where the error was made among several similar input fields. These fields are similar because they have the same name. But they are also in seperate forms and have different

Laravel hangs when running command via exec without sending it to background

你。 提交于 2021-02-17 06:34:07
问题 I have a weird issue that I've been stuck with for a couple of days now. I'm trying to generate a pdf in a Laravel app using chrome headless with this command google-chrome --headless --disable-gpu --print-to-pdf=outputfile.pdf http://localurl/pdf-html The command basically opens chrome in headless mode, navigates to the given url and prints it as pdf saving the file in the specified location. This command is working perfectly when run in my system's shell (I'm using Ubuntu 18.04). Now, my

Laravel: Undefined variable: RoomTypes (View:

懵懂的女人 提交于 2021-02-17 06:23:06
问题 So i have a simple drop down list that will display the list of data from my database. However im not sure how to display them using my controller. I did something like so: ShoppingCart.blade.php public function getCheckout(Request $request) { if (!Session::has('cart')) { return view('shop.shopping-cart'); } $RoomTypes = Room::all(); // RoomTypes are defined here $oldCart = Session::get('cart'); $cart = new Cart($oldCart); $total = $cart->totalPrice; $checkIn = $request->input('checkIn');

guzzle client throws exception in laravel

元气小坏坏 提交于 2021-02-17 05:29:07
问题 I am trying to make a http post request in laravel as below $client = new Client(['debug'=>true,'exceptions'=>false]); $res = $client->request('POST', 'http://www.myservice.com/find_provider.php', [ 'form_params' => [ 'street'=> 'test', 'apt'=> '', 'zip'=> 'test', 'phone'=> 'test', ] ]); It return empty response. On debugging ,following exception is occurring curl_setopt_array(): cannot represent a stream of type Output as a STDIO FILE* I am using latest version of guzzle. Any idea how to

PATCH 405 (Method Not Allowed) VueJs

此生再无相见时 提交于 2021-02-17 04:42:20
问题 I have route in group 'prefix'=>'admin' in web.php Route::post('/slideUpdate/{id}','SlideController@postSlideUpdate') In Add.vue i call function update() in methods axios.patch(`/admin/slideUpdate/${this.list.id}`,this.$data.list) In SlideController i have function public function postSlideUpdate(Request $request,$id) { $product = Slide::find($request->id);..$product->save(); } When i click button @click="update" i get error PATCH http://minhquanbicycle.com/admin/slideUpdate/1 405 (Method Not

Laravel eager loading with nested relationship

人走茶凉 提交于 2021-02-17 03:10:42
问题 I know this question has been asked but my situation is different. I have Post model with relationship to Comment model defined: /*Post Model*/ public function comments(){ return $this->hasMany('comment'); } and Comment model which each comment belong to one user : / comment model / public function user(){ return $this->belongto('user'); } now I want to query all post and eager load comments (of each post) along with user information who post the comment. anyway to make it work please ? thank