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..

Read more

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 ..

Read more

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 ..

Read more

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> ..

Read more

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 ..

Read more

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 ..

Read more

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() ..

Read more

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.’%’) ..

Read more

I’m trying to get laravel’s implemented email verification system working (https://laravel.com/docs/8.x/verification). What i did so far: Enabled the Feature emailVerification in the file config/fortify.php like so: … ‘features’ => [ Features::registration(), Features::resetPasswords(), Features::emailVerification(), Features::updateProfileInformation(), Features::updatePasswords(), Features::twoFactorAuthentication([ ‘confirmPassword’ => true, ]), ], … implemented MustVeriffyEmail in the app/Models/User.php file like so: <?php namespace AppModels; use IlluminateContractsAuthMustVerifyEmail; ..

Read more

composer.json { "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "type": "project", "require": { "php": ">=5.6.4", "laracasts/flash": "^3.0", "laravel/framework": "5.4.", "laravel/scout": "^7.1", "laravel/tinker": "~1.0", "laravelcollective/html": "~5.0", "laravelrus/localized-carbon": "dev-master", "maatwebsite/excel": "~2.1.0", "phpoffice/phpspreadsheet": "^1.12", "roumen/feed": "^2.10", "unisharp/laravel-filemanager": "~1.8", "watson/active": "^2.0", "yab/laravel-scout-mysql-driver": "^2.3" }, "require-dev": { "fzaninotto/faker": "~1.4", "mockery/mockery": "0.9.", "phpunit/phpunit": "~5.7" }, "autoload": { ..

Read more