#### Category : laravel-8

$message=MessageriesBroadcaster:: find($request->id)->where(‘broadcaster_id’,Auth::id()) ->addSelect( ["user_name" => User::select(‘nickname’)->whereColumn(‘user_id’, ‘users.id’)->limit(1)] ) ->first(); $message->content="sssss dddd";$message->save(); i can fetch messages correctly , but when i update the model and save, it update also delete_at column with and wihout using SoftDeletes on my MessageriesBroadcaster Model. Please help me to explain and resolve this issue Sourc..

I’m working with Laravel 8 to develop my project and in this project, I have created two tables. One of them is named users which simply contains user information of the website and the other one is tags which contains some hashtags that users can choose from them. I also created another table named tag_user ..

I have laravel backend autmated process which runs almost 80000 queries on the end of weekend. I experienced 100 % cpu usage while doing that process. but at the same time i see that laravel telescope also logging enteries in the database . Is that possible msql cpu usage is also increased by telescope? Source: ..

I’m working with Laravel 8 to develop my project, and in this project, I have made this method to return latest data from the DB, limiting 5 results: public function index() { $posts = Blog::all()->latest()->limit(5);; return view(‘blog’, compact(‘posts’)); } As you can see I have used latest() because, I’m using Laravel timestamps (created_at, updated_at) and .. Read more 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 ..

I’m working with Laravel 8 to develop to my project. Now I want to show some data from the DB, so I coded this in the Controller: use AppModelsQuestion; public function index() { questions = Question::all(); return view(‘home’, compact(‘questions’)); } Then at the view home.blade.php, I added this: @foreach($questions as$question) <tr> <td style="text-align:right;"> <h3 ..

I’m working with Laravel 8 to develop my project, and I have made this form, in order to add some data into db: <form class="mb-3" method="POST" action="/ask"> @csrf <div class="form-group"> <label for="topic" class="BKoodakBold">Question Title</label> <input name="title" type="text" class="form-control BSinaBold" id="topic" required> </div> <div class="form-group"> <label for="topic" class="BKoodakBold">Question Body</label> <textarea name="body" class="form-control BSinaBold" id="comment" required></textarea> </div> ..

I am coding CRM for a client. Data table with flexible column names requested from me. In order to achieve this, I have configured the database as follows. I can bring the columns of the projects according to the id value of the user and reflect them on the front face. But I couldn’t associate ..

I am having my APIs (built using Laravel 8 Framework) hosted in a subdomain – webapi.somedomain.com. And am running a local version of Frontend UI built using React Framework and Axios library for the HTTP Requests. I have hosted in a Shared Hosting space (cPanel + CentOS) I am facing an issue while hitting the ..

In my Laravel 8. * project, I include a js file (originally passed through webpack). In the browser, the files are connected, displayed in the Resource tab, and the link to the file in Elements is working. However, when accessing a function in this js file, a ReferenceError occurs: uidPaste is not defined. webpack.mix.js const ..

Hello! I am working on Laravel project I have a form for invoices which include two date fields along with other fields. The two dates are named start_date and end_date. I want to select the end date based on start date which date should be the next month just one day before. For example .. ..

I have a table with columns that users can dynamically change and add. Here, when adding rows, I mirror the column names on the frontend, but when saving, I cannot get the column names and therefore cannot save. How can I do that? As you can see in the images, I have as many entrances ..

I have a trait CacheClear: trait CacheClear { protected static function boot() { parent::boot(); /** * After model is created, updated, or deleted – clear cache. */ static::saved(function () { Artisan::call(‘cache:clear’); }); static::deleted(function (){ Artisan::call(‘cache:clear’); }); } } I call it in Models/Comment (and in some other models too), and after comment creating, updating or ..

Can anyone please help to fix this issue. I want to add order id another table. in this case its not working. [ <?php namespace AppHttpControllersFrontend; use AppHttpControllersController; use IlluminateHttpRequest; use IlluminateSupportStr; use AppModelsBackendProduct; use AppModelsBackendCategory; use AppModelsBackendSlider; use AppModelsFrontendOrderProd; use AppMailOrderMail; use AppModelsBackendOrder; use AppModelsUser; use IlluminateNotificationsChannelManager; use IlluminateSupportFacadesNotification; use IlluminateNotificationsNotifiable; use AppModelsFrontendCart; use ..

I am new to Laravel and i am confused about which laravel version to use in 2021. Are the latest versions easy to use like Laravel 6,7 and 8. I would be grateful if you guys reply with the best option. Sourc..

This question is directly connected with the one I’ve made few days ago. I want to create a middle table called "iscrizione". It has just two PK attributes ("idCorso","idUtente") that reference to the PKs of "corsoscii" and "users". I defined the PKs/FKs as integer "unsigned", to avoid problems with the data type. Sadly, the same ..

I’m coding a CRM on Laravel. My customer requested a flexible column name. Each customer on CRM will be able to add and remove column names and give the name they want. I planned a database algorithm accordingly, do you think this makes sense? What is the best solution? project_cloumns table: id, user_id, data project_lines ..

I have three nullable fields ( Coupon, Membership, Offer) which are to be filled from requests. I want to validate/restrict users so that they can only fill one of these fields. As the fields are not required, I cannot use the required:* validators to handle this. I know this can be handled in the front-end, ..

I’ve built a simple "Policy" class for "User" model, and it just won’t register with Laravel. I keep testing the URIs and keeps giving me the records when it should reject. How would I be able to make this work despite already registering it? My routes look like this: Route::middleware([‘api’])->group(function () { Route::resource(‘users’, ‘AppHttpControllersUsersController’); Route::prefix(‘auth’)->group(function() ..

I’ve recently found a Laravel-UIKit preset and I know it strictly noted there that It should only be used on a fresh install and not be added to an existing project, but silly me, still added it anyways. Now my project seems to not work the way it used to be. I’ve tried removing all ..

I’m building a site using Laravel 8 and Jetstream. Jetstream is opinionated about the javascript / css framework, which is great, but I’m needing to add an external javascript library to one of my components, and I don’t see anywhere to add them in the default app layout. So I added a stack for the ..

I do this: Cookie::queue(‘mytesssst’, ‘xaxaxaxaxa’, 60*24*7*52); if I check my cookies, I see though that the value it sets, is actually the session id of laravel retrieval of the value via Cookie::get works fine question: will the cookie expire with the session, or will it stay alive as hinted in the example, for one year? ..

I am using Laravel 8 for a restful API. a table in the database has following fields report_date , supervisor_id and supervisor_note I want to retrieve a result that count number of reports in a date and also count of all null values in supervisor_notes field. I used the following Laravel code $reports=DB::table(‘reports’) ->where(‘supervisor_id’,’like’, ‘%’.$supervisor_id.’%’) ..