Category : laravel-blade

I am quite new to Laravel,and I dont understand why the pagination is not working properly in my case. It displays all of the hostnames, not only the 48. view.: @if($posts->isNotEmpty()) @foreach($posts as $post) <div class="col-xl-3 col-lg-3 col-md-3 col-sm-3 col-4" style="padding-right:5px; padding-left:5px; padding-top:5px;"> <ul class="list-group" style="text-align:center;"> <a href="hiperlink/template/{{ $post -> hostname }}" class="list-group-item list-group-item-action">{{ $post ..

Read more

i have created a profile where users can add their education fields. when there is no value in the database it throws an error. how can i get rid of this ? Attempt to read property "degree" on null. public function myEducations() { return $this->hasMany(‘AppModelsEducation’,’user_id’)->orderByDesc(‘endDate’); } controller public function myProfile(AppModelsUser $user) { $user = Auth::user(); ..

Read more

I want to use the drop down menu, and I have a table below. How do I show the data in this table on Blade? My problem is showing submenus. (Parent_id and child item) public function up() { Schema::create(‘menu_items’, function (Blueprint $table) { $table->id(); $table->unsignedBigInteger(‘menu_id’); $table->string(‘title’,255); $table->string(‘url’,255)->nullable(); $table->string(‘target’,255)->nullable(); $table->string(‘icon_class’,255)->nullable(); $table->string(‘color’,255)->nullable(); $table->integer(‘order’); $table->string(‘route’,255)->nullable(); $table->text(‘parameters’)->nullable(); $table->foreign(‘menu_id’)->references(‘id’)->on(‘menus’); $table->integer(‘parent_id’)->nullable(); ..

Read more

I have an error: "Trying to get property ‘id’ of non-object (View: C: xampphtdocsklikdesakuresourcesviewsadminpostscreate.blade.php)" I had used it without laravel collective form (i don’t know its name) example: {{!! Form::select() !!}} This is my code: create.blade.php @foreach ($categories as $category ) <option value="{{$category->id}}">{{$category->name}}</option> PostController.php public function create(){         $this->authorize(‘create’, Post::class);         $categories = Category::pluck(‘name’,’id’)->all();         return view (‘admin.posts.create’, [‘categories’=>$categories]);     } public function store(){         $this->authorize(‘create’, Post::class);         $inputs = request()->validate([             ‘title’=>’required’,             ‘post_image’=>’file’, //mime: jpeg, png             ‘body’=>’required’,             ‘category_id’=> ‘required’         ]);         if(request(‘post_image’)){             $inputs[‘post_image’] = request(‘post_image’)->store(‘images’);         } ..

Read more

Vue Version: 2.6 Laravel Version: 5.4 I have VueJS DOM with :disabled flag within laravel blade file(laravel mix), main data contain, images object like code below: data() { return { images: {} } } then below is piece of button source code: <button :disabled="!images.pict0" @click="showPict(‘pict0’)"> Show Image </button> Communication: Asynchronous Problem: when asynchronous data came, ..

Read more

In Vue3, inline-templates were depreciated and now slots are used. Is it possible to have 2-way binding of variables for Vuejs components written in blade templates? I want to have 2-way binding for Vue components that’s written inline with blade templates. Although I know I can pass data like <example-component name="Hello World"> It is a ..

Read more

I’m getting into laravel and I’m trying to work with blade templating but its not rendering. All my examples are coming for the laravel documentation. This has made me made for 3 days. Please HELP So here is my demo.blade.php located in resources/views/demo.blade.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Pagetittle</title> </head> <body> <h2>Template’s content</h2> ..

Read more

I’m using Laravel blades/views to generate files by templates from the custom console command. Unfortunately, any of the variants from official documentation are not working. This is how I’m trying to pass data to the view: $info = ‘Some info’; view(‘my_template’, compact(‘info’)); or view(‘my_template’, [‘info’=>’Some info’]); or view(‘my_template’)->with([‘info’=>’Some info’]); or use View as View; View:make(‘my_template’,[‘info’=>’Some ..

Read more

Okay, so when i just add to Laravel blade view another blade with @include it throw me a code as plain text. blade1.blade <div class="container-fluid"> @include(‘chat’) </div> chat.blade <div class="row"> <div class="col-md-5"> @role(‘Admin’) @if($data[‘users’]->count() > 0) @foreach($data[‘users’] as $user) <div class="panel panel-default start" style="display:block"> <div class="panel-heading chat-toggle" data-id="{{ $data[‘messages’] }}" data-user="{{ $user->to_user }}"> <h3 class="panel-title"><i ..

Read more

I know about something like this: {{ old(‘contents’, $page->contents ?? null) }} But what about more complicated cases, like checkboxes and selects? <select id="custom_template" name="custom_template"> {{–default empty option, if nothing is selected yet–}} <option label=" " {{ ($page->custom_template == null)? "selected" : "" }}></option> @foreach($templates as $template) <option value="{{ $template->id }}" {{ ($page->custom_template == $template->id)? ..

Read more

Cannot resolve file ‘logo.png’ – said the HTML <img src="logo.png" alt="Logo" width="314" height="70"> The HTML keeps saying it can’t find it, but it works. Meanwhile, if I tell it that it’s in public/logo.png, then its a broken image. If this is a feature, how can I turn off this markup. If It works, I don’t ..

Read more