biishmar

biishmar

Senior Web Developer at RetailGenius

Colombo

Member Since 1 Year Ago

Experience Points 37,590
Experience
Level
Lessons Completed 158
Lessons
Completed
Best Reply Awards 31
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

21 Aug
2 months ago

biishmar left a reply on Call To A Member Function GetClientOriginalExtension() On Null

@Amalmax You have declared the enctype in an input field, I think it should be in a form field.

biishmar left a reply on Categories, SubCategories And Products With Pagenation

@MrFiliper You don't have to create two table for categories and subcategories just single table is fine. create a new column in the category table as a parent category and if its subcategories just mention the main category id in this column.

25 Jun
4 months ago

biishmar left a reply on Advanced User Permissions

@misvijay U can use same logic that u have done in codeigniter or put the same logic in middleware and menu to constraint the permission according to role.

biishmar left a reply on MethodNotAllowedHttpException Only Production

@SANTI1111 try this

php artisan cache:clear

biishmar left a reply on Trying To Get Property Of Non-object

@irankhosravi try this

public function user()
{
    return $this->belongsTo(User::class);
}
22 Jun
4 months ago

biishmar left a reply on Connection Refused

@teguh_rijanandi check your DB_HOST value, i dont think it should be 127.0.0.1.

biishmar left a reply on Json

@chagouani just return the taches it automatically become json

return $taches;

biishmar left a reply on Whats Mean No Such File Or Directory

@teguh_rijanandi Show your db config and env file. u might connecting with sqlite i think so.

21 Jun
4 months ago

biishmar left a reply on BadMethodCallException In Controller.php Line 283: Method [postEmail] Does Not Exist.

@jackym

In forgotPasswordSubmit function, u r calling postEmail function

$response = $this->postEmail($data);

the above line indicate u r calling postEmail function but i couldnt find that function in UserController

biishmar left a reply on BadMethodCallException In Controller.php Line 283: Method [postEmail] Does Not Exist.

@jackym Need to see UserController, cuz error happens on that class.

biishmar left a reply on Problem With Method "show" In My Controller

@vasiliy_v r u sure u have data in database with id of 1?

biishmar left a reply on BadMethodCallException In Controller.php Line 283: Method [postEmail] Does Not Exist.

@jackym r u using inbuilt forgot password function or u create on your own?

23 May
5 months ago

biishmar left a reply on How To Refer Outer Table In A Subquery

@ashwini7 if u want to use A.C table value,

AB::with(['A', 'B', 'A.C' => function($query) {
    $query->where() // here u can get the C table value not outside
}]);

biishmar left a reply on Selecting Laravel Version

@Nagamma its depends on the php version, if u r using 5.6 stay at laravel version 5, if u r using latest version of php u can download latest version of laravel

biishmar left a reply on Populate Database In Laravel

@rory it's better to create those in sql file and u can run those using mysql cmd source command its fast.

22 May
5 months ago

biishmar left a reply on HasMany Relationship To Model And Continue Use Chain Methods

@zhezhebie this function will run everytime u update any data, i dont think this is the right code for u..

biishmar left a reply on Redirect()->intended('default') Is Not Working As Expected?

@GTHell What do u mean profiel page is not static? any way after u login u suppose to redirect somewhere that is profile page, i think there is only one route for profile page, if u want to redirect the user to the page before they logged in then u got to capture that url and redirect

21 May
5 months ago

biishmar left a reply on Redirect()->intended('default') Is Not Working As Expected?

@GTHell

#try to use this

redirect()->route('route-name-for-profile-page');

biishmar left a reply on HasMany Relationship To Model And Continue Use Chain Methods

@zhezhebie

#instead of this
$level->update(['status' => 4]);
$units->update(['status' => 4]);
$lessons->update(['status' => 4]);
        
#try this
$modelnameforlevel::whereIn('id', $level->pluck('id'))->update(['status' => 4]);
$modelnameforunit::whereIn('id', $level->pluck('id'))->update(['status' => 4]);
$modelnameforlessons::whereIn('id', $level->pluck('id'))->update(['status' => 4]);
18 May
5 months ago

biishmar left a reply on Get Multiple Condition Into Array

@kankai You are accessing a database too much, this will make your server cpu to 100%, never do the database access inside loop... Ever heard of N + 1 problem?

biishmar left a reply on Is There A Way To Make The Helper Function Str_random Return Only Letters From A-z And Not Include Numbers?

@p0t4t0 use this function

function generateRandomString($length = 10) {
    $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomString;
}

biishmar left a reply on API Resources

@sghimire Author have many Books and Books should belong to Author. This is how relationship works with book and author, if its many to many use belongsToMany function.

biishmar left a reply on Middleware Causes Route Note Defined Error..?

@Jman you should use authorization for this, check it here https://laravel.com/docs/5.6/authorization

biishmar left a reply on How To Fetch Data From Api In Laravel

@hidayat3676 try cURL

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.thesportsdb.com/api/v1/json/1/searchteams.php?t=Arsenal",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Cache-Control: no-cache",
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

the result is not array its json so use json_decode. this code is pure cURL or ucan use guzzlehttp package from composer..

biishmar left a reply on How To Use Template With Laravel?

@hanisster create js and css file in public folder and access those by /public/bootstrap.css, this will retrieve bootstrap file if u have inside public folder, whatever the template is if they have only html and css and js , can be use in laravel, if u have more doubt. check laravel from scratch tuttorial here.

biishmar left a reply on How Not To Use DB In The Following Query Having A Subquery

@Quadram Create a pub model by referring laravel site then try this query..

Pub::where('distance', '<', $distance)->selectRaw('*, (6371 * acos(cos(radians(40.4169473)) * cos(radians(latitude)) * cos(radians(longitude) - radians(-3.7035285)) + sin(radians(40.4169473)) * sin(radians(latitude)))) AS distance')->orderBy('distance')->get();

biishmar left a reply on Return Foreach Loop

@Lordgreymaul Create a variable as an array and push those value to that array

public function getMailbox() {
            $messages = LaravelGmail::message()->unread()->preload()->all();
            $messagesArray = [];
            foreach($messages as $message) {
                $modifiedData["id"] = $message->getId();
                $modifiedData["date"] = $message->getDate();
                $modifiedData["from"] = $message->getFromEmail();
                $modifiedData["email"] = $message->getPlainTextBody();
                
                $messagesArray[] = $modifiedData;
            }
            return compact('messagesArray');
        }

11 May
6 months ago

biishmar left a reply on Profile Photo Update Failure

@abudo if u r forcing https then do it in server or .htaccess file.

biishmar left a reply on How Do I Combine Three Foreach Loops Into One ?

@HopesAreMiracle group by your result by code it will become single record as u expected.

26 Apr
6 months ago

biishmar left a reply on Cant Understand Eloquent Distinct

@alexMafus The reason you are seeing 5 john doe is those 5 rows have different value is different column, there might be a two john doe as different person, distinct only works if all the coulmns are equal with another row...

biishmar left a reply on New Changes Not Being Detected

@tubbrez did u check that model file in server that what ever u changed are there?

biishmar left a reply on How To Get Data From Relationship Table Using Laravel Eloquent Model?

@dreamxyz as long as primary and foreign key are same it will work, but using alpha-numeric in primary and foreign is not good practice, it will slowdown ur query submission time, better use numeric only

biishmar left a reply on Show Single Post In Laravel With Ajax Call

@beginner_luck put console.log the data on button click and check the data from button from inspect element compare it.

biishmar left a reply on Cant Understand Eloquent Distinct

@alexMafus Eloquent distinct is same as mysql distinct, distinct will unique the row when all coulmns r equal, first checkout what mysql distinct do.

biishmar left a reply on Query To Eloquent Model

@Skizo @devk is right, he gave you the what u need author name and count of books.

The query above is simplified version of the actuall query so I dont really can use that.

i thought every one need simplified query for run their website fast.

I used this method already, I thought there are ways to use Eloquent relationships.

If u want eloquent way use Author as main model and call book relationship like @devk said.

25 Apr
6 months ago

biishmar left a reply on Image Upload Using Laravel And Ajax.

@beginner_luck if u r creating a button for a row, u better create that through controller side and append to table

biishmar left a reply on How To Get The Second One?

@haizone

$post = Post::where('column', $condition)->skip(1)->take(1);

biishmar left a reply on Union With Pagination - Laravel 5.6

@oroalej i dont know the solution for the current problem, if u want pagination that badly u have to create manually..

check this link https://laravel.com/docs/5.6/pagination#manually-creating-a-paginator

biishmar left a reply on Search In Eloquent

@alexMafus what is the different between search name and unique name variables?

biishmar left a reply on Image Upload Using Laravel And Ajax.

@beginner_luck after u storing that data , are you appending that info to table in same page?

biishmar left a reply on Union With Pagination - Laravel 5.6

@Agelios i aint the one asked this question

biishmar left a reply on Need Help Category Wise Post Show

@towhid it seems u lack data, do u have any post data with a category_id as 6?

biishmar left a reply on Union With Pagination - Laravel 5.6

@oroalej would you please show that code? paginate only works for query builder, i think u calling paginate from collection.

biishmar left a reply on Url Previous - Moving Between More Pages

@DarkHarden You want that query string to be attached while u go back or u dont want it?

biishmar left a reply on Image Upload Using Laravel And Ajax.

@beginner_luck create that view button from controller and send it to ajax so u can append to your table.

biishmar left a reply on Redirect Problem

@djay your solution at the login function, put the previous url in session and overwrite the redirect in login function..

biishmar left a reply on Need Help Category Wise Post Show

@towhid i dont think post is belong to many category, did u create a column category_id in post table?