I am planning to create a web project by using the Laravel framework. I have worked on Laravel 5.1(LTS) and later haven’t learned further versions like 6.x and 7.x. For the new project, I need to use …
Tag: laravel-5
Return default value if belongTo relation is returned null
I have a belongTo relation, if join condition is matched then ok but when there is no data for this it returns null. In this case, I want it returns default value as I expected. This is what I try but …
laravel BelongsToMany pagination
i have 2 model 1 – category with parent and child class Category extends Model { protected $primaryKey = ‘id’; public $fillable = [‘slug’,’title’,’icon’,’parent_id’]; /** * Get the index name …
Multiple Layouts in Laravel Blade, Vue-Router [closed]
I am trying to separate user & admin functionality but can’t find a satisfactory solution. After login, the user is authenticated and then he is redirected to either user or admin blade view …
How to get data with sorting from controller?
I have this query I want to get data from the database with alphabetically sorting $states = State::where(‘status’, 1)->sortBy(‘name’)->get();
Laravel : email send multiples times to one user
I want send email to many users in one time but in this case the mail is sending multiple times to one user it self. Try to email each person one time only(not spam the users) Its didnt work with …
How can I get response from guzzle in Laravel 5.3
I try like this : $client = new Client(); $res = $client->request(‘POST’, ‘https://api.orange.com/smsmessaging/v1/outbound/tel:+phone/requests/’, [ ‘headers’ => [ ‘…
Send POST request from an external site to Laravel
I want a way to send POST from a PHP site to another one built with Laravel (the second one) to return a JSON value! The PHP site (I use jQuery to send this POST): $(‘#get_link_form’).on(‘submit’, …
Call to a member function addEagerConstraints() on string
I want to calculate the average of the column of nested morph relation. Model Function public function trader_ratings() { return $this->morphMany(TraderRatings::class, ‘rateable’) ->…
Allow users with is_request 1 to not log in
I am currently working on a system where people can submit a registration request. The admin will need to accept the request in order for the user to be able to sign in. In my database, I have a field …