[Solved] How to use route in Javascript

You can use the route helper with string placeholders and then replace the placeholder with javascript variables. function AddFavourites(productid, userid) { let url = “{{ route(‘product.like’, [‘id’ => ‘:id’]) }}”.replace(‘:id’, productid); $.ajax({ method: ‘post’, url: url, data: { ‘user_id’: userid, }, }).done(function(response, status){ // }).fail(function(jqXHR, textStatus, errorThrown){ // }); } 0 solved How to use … Read more

[Solved] Using insert with condition on laravel [closed]

Well the reason it inserts twice is you make an DB::insert() and also create a new book using $book->save() This should work better: $book = new Book; $ta = DB::table(‘book’)->selectRaw(‘MAX(ta) AS ta’)->first()->ta; if($ta == 0){ $book->ta = 1; $book->tb = 1; } else { $tb = DB::table(‘book’)->selectRaw(‘MAX(tb) AS tb’) ->where(‘ta’, $ta)->first()->tb; if($tb <= 20){ $book->ta … Read more

[Solved] .BLADE.PHP IS NOT WORKING IN MY LARAVEL PROJECT. .PHP IS WORKING FINE FOR MY VIEWS

All I can suggest on the information you provided is: Make sure when you put your views inside other folders you use dot syntax and not slashes like this: View::make(‘folder.view’); Instead of View::make(‘folder/view’); Folder Structure: |views| –|folder| —-view.blade.php 0 solved .BLADE.PHP IS NOT WORKING IN MY LARAVEL PROJECT. .PHP IS WORKING FINE FOR MY VIEWS

[Solved] How to group and create relationship from JSON response [closed]

It sounds like you want to group the items by league. Let’s use our array_reduce friend for that. This is the basic syntax: $arr = [ [ “leauge” => “sweeden”, “fixture” => “12” ], [ “leauge” => “sweeden”, “fixture” => “13” ], [ “leauge” => “germany”, “fixture” => “14” ], [ “leauge” => “france”, “fixture” … Read more

[Solved] How to add missing keys to array

function getAllYears(array $array): array { $allKeys = []; foreach ($array as $data) { foreach ($data[‘data’] as $years) { if (!in_array($years[‘x’], $allKeys, true)) { $allKeys[] = $years[‘x’]; } } } sort($allKeys); return $allKeys; } function addMissingKeys(array $array): array { $allYears = getAllYears($array); foreach ($array as $key => $data) { $currentYears = array_map(static function ($year) { return … Read more

[Solved] Getting particular object

@kayal if you are still learning then this is good but sometime you should read the documentation here is the method that you can do this easily For Example Assuming Table name test +————+ | id | data | +————+ | 1 | {…} | +————+ suppose you have Model Test.php Then add a protected … Read more

[Solved] How to Login with username, email, phone number

You can use a OR statement to check multiple conditions: <input id=”login” type=”text” class=”form-control {{ (@error->has(‘phone’) || @error->has(’email’) || @error->has(‘name’)) ? ‘is-invalid’ : ” }}” name=”email” value=”{{ old(‘phone’) ?: old(’email’) ?: old(‘name’) }}” required autofocus> solved How to Login with username, email, phone number

[Solved] Getting particular object

Solved: Getting particular object is a common problem faced by many developers. It can be difficult to find the right object when dealing with large datasets or complex data structures. Fortunately, there are a few techniques that can be used to help you find the object you are looking for. In this article, we will … Read more

[Solved] Vue js in laravel [closed]

you just need to write this.tweets also you need to change your callback function to arrow function to allow you to access your state like this async recupera_post(){ await axios.get(‘api/schedulepost’) .then((response) => { console.log(response.data) this.tweets = response.data }) } } 3 solved Vue js in laravel [closed]

[Solved] Selecting Data from data base SQL

try this one first away to get data. $check = DB::select(“select * from accounts where username = ?”,[$data[‘username’]]); second away to get data. $check = DB::select(“select * from accounts where username = :userName”,[‘userName’ => $data[‘username’]]); 1 solved Selecting Data from data base SQL

[Solved] How I Can send a file with Ajax?

You need to create a form data object. In the ajax function, set processData to `false. Because data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type “application/x-www-form-urlencoded”. If you want to send a DOMDocument, … Read more