#### Category : laravel-5.8

I’m working with Laravel 5.8 and in this project, I want to insert a session value into the DB: if(session(‘video-products’)){ UserVideo::create([ ‘user_id’ => auth()->user()->usr_id, ‘product_id’ => session(‘video-products’), ‘order_id’ => $orderId, ]); } But it does not work out and inserts nothing. And when I dd(session(‘video-products’)), I get this: array:1 [▼ 0 => 33 ] And .. Read more I’m using Laravel 5.8 and I have added this my Controller:$details = []; $attrPro = ProductAttribute::where(‘product_id’,$product->prd_id)->get(); array_push($details,$attrPro); foreach($attrPro as$attr) { $catPro = CategoryAttribute::find($attr->cat_attr_id); array_push($details,$catPro); } return view(‘frontend.video’, compact(‘product’,’attrPro’,’details’)); But now I get this error: Use of undefined constant attrPro – assumed ‘attrPro’ (this will throw an Error in a future version of ..

I have added this to my Controller method: $details = [];$attrPro = ProductAttribute::where(‘product_id’,$product->prd_id)->get(); foreach($attrPro as $attr) {$catPro = CategoryAttribute::find($attr->cat_attr_id); } Basically$attrPro holds the value attributes of a product such as (size, weight, length) and the table structure of it looks like this: 1 id Primary bigint(20) UNSIGNED AUTO_INCREMENT 2 product_id bigint(20) UNSIGNED ..

I’m using Laravel 5.8 to develop my project and in this project I have used Route Model Binding to retrieve some data from the DB and show them at the View. So at the first place, I put this link: <a href="{{ route(‘video.watch’, [‘product’=>$detail->product->prd_id,’order’=>$order->ord_id]) }}">Watch</a> And here is the route video.watch: Route::get("video/watch/{product}/{order}", "[email protected]")->name(‘video.watch’)->middleware(‘auth’); Then at ..

I’m using Laravel 5.8 to build my Online Store and in this Online Store there are two types of products. Physical products such as (books, magazines & etc) and Video type products. Now I need to determine that if a user has added a Video type product and ALSO a Physical product to his Shopping ..

I have added this to my Controller method: if(in_array(null, $product_videos)){ Session::put(‘physical’, 1); }else if (in_array(!null,$product_videos) && in_array(null, $product_videos)) { dd(‘returns true’); }else{ Session::put(‘physical’, 0); } So as you can see here, I have added !null at the else if condition to check if$product_videos contains empty and !empty values. But this is wrong since ..

I’m making an Online Store with Laravel 5.8 and in this project I have some Video products to sell and also some physical products (such as books, magazines and etc) to sell. Now I want to make a session, when user has added a Video product and also added a Physical product to his Shopping ..

I’m making an Online Store with Laravel 5.8 and in this project I have some video products to sell and also some physical products (such as books, magazines and etc) to sell. Basically if user adds Physical products to his Shopping Cart, at the next request he has to select the Delivery Type for sending ..

I’m using Laravel and Javascript for my project and I wanted to load some videos in the page using JWPlayer. So I have added this into my blade: <div id="container1"></div> And at the end of blade, I’ve added this: @section(‘scripts’) <script src="{{asset(‘js/jwplayer/jwplayer.js’)}}"></script> <script type="text/JavaScript"> jwplayer("container1").setup({ sources: [{ file: "{{ asset(‘upload/video/products/$prd_video_preview’) }}", label: "360", "default": "true" .. Read more I have a PHP array$logEnabled = explode(‘,’,$baby->logEnabled); // dd($logEnabled); result array:3 [▼ 0 => "pee" 1 => " poop" 2 => " feed" ] I’m trying to pass that to JS , I did this console.log({{json_encode($logEnabled) }}); I kept getting [&quot;pee&quot;,&quot; poop&quot;,&quot; feed&quot;] I want to see [pee,poop,feed] Any hints for me Sourc.. Read more I’m working with Laravel 5.8 and I wanted to upload two custom files so I coded this: if ($request->file(‘prd_file’) AND $request->file(‘prd_file_preview’)) {$file = Request::file(‘prd_file’); $filename =$file->getClientOriginalName(); $path = public_path().’/upload/products/’;$request->file(‘prd_file’)->move($path,$filename); $file_preview = Request::file(‘prd_file_preview’);$filename_preview = $file_preview->getClientOriginalName();$path_preview = public_path().’/upload/products/preview/’; $request->file(‘prd_file_preview’)->move($path, $filename_preview); } But after process gets completed nothing is uploaded at /upload/products/ .. Read more I’m working with Laravel 5.8 and I wanted to upload two video files to the Server, so I coded this: if ($request->file(‘prd_video’) AND $request->file(‘prd_video_preview’)) {$video = Request::file(‘prd_video’); $videoname =$video->getClientOriginalName(); $path = public_path().’/upload/video/products/’;$request->file(‘prd_video’)->move($path,$videoname); $video_preview = Request::file(‘prd_video_preview’);$videoname_preview = $video_preview->getClientOriginalName();$path_preview = public_path().’/upload/video/products/preview/’; $request->file(‘prd_video_preview’)->move($path, $videoname_preview); } But now I get the error: Illuminate .. Read more I’m working with Laravel 5.8 and I want to upload two videos, so I coded this at the Controller: if ($request->file(‘prd_video’) AND $request->file(‘prd_video_preview’)) {$video = Request::file(‘prd_video’); $videoname =$video->getClientOriginalName(); $path = public_path().’/upload/video/products/’;$moved = $video->move($path, $videoname);$video_preview = Request::file(‘prd_video_preview’); $videoname_preview =$video_preview->getClientOriginalName(); $path_preview = public_path().’/upload/video/products/preview/’;$moved_preview = $video->move($path, $videoname_preview); } But now I get .. Read more Created HasMany Laravel Nova field, on the related resource added indexQuery where joined another table. But as a result I got another ID and created_at in the result table. HasMany::make(‘Changes log’, ‘logger’, AppNovaMyResource::class), In MyResource /** * Get the fields displayed by the resource. * * @param IlluminateHttpRequest$request * @return array */ public function ..

I’m working with Laravel 5.8 and I wanted to show some data based on the DB so I have added this to the Controller: class CertificateController extends Controller { public function index() { $uid = auth()->user()->usr_id;$member = Member::where(‘mbr_usr_id’, $uid)->first(); //dd($member->mbr_national_code); returns 4312161909 $certificates = Certificate::where(‘national_code’,$member->mbr_national_code)->get(); return view(‘frontend.certificates.index’, compact([‘certificates’])); } } And at the Blade, ..

I want to submit a form with checkbox. Here is my form: @foreach($courses as$course) <tr> <td>{{ $course->creatorObject }}</td> <td><form id="myForm" data-flag="0" action="{{ route(‘acceptWallet’) }}" method="POST"> @csrf <input name="invisible" type="hidden" value="{{$course->creatorObject }}"> <input type="checkbox" id="btn-submit" name="wallet_checked" onchange="this.form.submit();"> </form></td> </tr> @endforeach So whenever a user clicks on this Checkbox, the form must be submitted immediately. ..

I’m trying to catch the output of the command and throw error/success accordingly. $resultFromServer = []; SSH::run($command, function($line) { echo$line.PHP_EOL; if($line!= null) { array_push($resultFromServer, $line); // crash } }); dd($resultFromServer); Check out my output WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config WARNING: Kubernetes configuration file is world-readable. This is insecure. ..

I’m working with Laravel 5.8 to develop my project and I have a table on my blade for showing some information about the database table. And at the end of this table, I have added this: <td> <form id="myForm" data-flag="0" action="{{ route(‘acceptWallet’, [‘nahadName’=>$course->creatorObject,’nahadLab’=>$course->cor_creator_object_type,’codCode’=>$course->cod_code,’registeredNum’=>$course->registeredCount]) }}" method="POST"> @csrf <input type="checkbox" id="btn-submit" name="wallet_checked" onchange="this.form.submit();"> </form> </td> <td> <a ..
I want to delete a part of array in Laravel. So here is my array: And this is retrieved from the DB table row: Now I want to delete the first part of this data, so I added this at the Controller: public function DeleteDiscount(Request $request,$fst, $id) { //$id is 0 $find = .. Read more I have a form like this: <form method="POST" action=""> <div class="row" id="dynamic_field"> <div class="col-md-4"> <div class="form-group"> <label for="discountValue">Discount</label> <input type="text" class="form-control" id="discountValue" name="discount_value[]"> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="timeSpan">Time</label> <input type="text" class="form-control datepicker" id="timeSpan" name="time_span[]"> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="labelDiscount">Label</label> <input type="text" class="form-control" id="labelDiscount" name="discount_label[]"> </div> </div> </div> <div class="row"> .. Read more I have a table form input like this: <td> <ul style="list-style: none;" class="p-0 m-0"> @foreach($plan->festivalMembers->whereIn(‘fsm_role’, ‘author’) as $writer) <li> <input class="form-input" type="text" name="festival_authors[]" value="{{$writer->user->member->mbr_name }}"> </li> @endforeach </ul> </td> So basically $plan->festivalMembers->whereIn(‘fsm_role’, ‘author’) retrieves more than one value and now I need to display them as a form value and then submit them by .. Read more I have a table and retrieved some data with this table at the Blade. Now I have added a checkbox as the first column of this table. <form method="POST" action="{{ route(‘finalFestival’) }}"> @csrf <table class="table table-sm table-bordered table-striped table-hover"> <thead class="thead-dark"> <tr> <th>Choose to pay</th> <th>Tracking Code</th> <th>Date of Submission</th> … </tr> </thead> <tbody> @foreach( .. Read more Need to ask how can I access Auth::user() instance in a file within config directory of laravel app. What I am doing now is: And It gives me error: Couldn’t find any possible solution, Any help would be appreciated. Thanks and Regards Sourc.. Read more I tried to display data inside a table for admin. Here is my admin.blade.php: <form action="post_namaadmin"> <input type="text" name="txtnamaadmin" id="txtnamadmin" value="1"> <input type="submit" name="btnnamadmin" id="btnamaadmin"> </form> <div class="card-body"> <table border="1"> @foreach($datalama as $rows) <tr> <td>ID : </td> <td>{{$rows->userid }}</td> <td>Nama : </td> <td>{{ \$rows->nama }}</td> </tr> <tr> <td>Section</td> <td>IM</td> <td>CO</td> <td>SH</td> <td>PL</td> <td>RI</td> <td>ME</td> ..