Questions tagged [laravel-facade]

Facades in Laravel framework provide a "static" interface to classes that are available in the application's IoC container.

Facades provide a "static" interface to classes that are available in the application's IoC container. Laravel ships with many facades, and you have probably been using them without even knowing it! Laravel "facades" serve as "static proxies" to underlying classes in the IoC container, providing the benefit of a terse, expressive syntax while maintaining more testability and flexibility than traditional static methods.

168 questions
0
votes
0 answers

How to call Facades method from boot method?

In laravel 6 app I created facade app/Facades/MyFuncsClass.php :
mstdmstd
  • 2,195
  • 17
  • 63
  • 140
0
votes
1 answer

How to Implement Default Laravel Reset Password in Lumen 6x

Im new to Laravel / Lumen framework and im trying to replicate the the default reset password trait for Laravel https://laravel.com/docs/5.7/passwords to my Lumen Project. However, I stumbled upon this error when I post to sumbit email endpoints.…
0
votes
1 answer

How and where does the Facade class property $app get set?

I have done a lot of digging and cannot seem to see where or how the $app property is set in Illuminate\Support\Facades\Facade I am aware all Facades are set in config/app.php and auto loaded using the Illuminate\Foundation\AliasLoader however i can…
tmkiernan
  • 375
  • 1
  • 16
0
votes
2 answers

Get data from DB facade en php laravel

I have this query en php laravel $query = DB::select("SELECT * FROM solicitudes WHERE id = 5"); My table "solicitudes" have the columns "id, titulo, proveedor" The query result is only one row, and I want to take the value of "titulo". I try it…
0
votes
1 answer

Get id of newly added object by Id (using facade)

I want to get Id of newly added row in database. here is the code: public function store(Request $request) { $me = Translation::save(); return $me->id; } Translation extends Facade but this code returns error : Trying…
O. Shekriladze
  • 1,346
  • 1
  • 19
  • 36
0
votes
1 answer

Why is this Laravel facade not found in some environments?

I have a call to a Laravel facade that fails with a 'class not found' error. The odd thing is that it works in my development environment, but not my staging environment. It's particularly bizarre given that both environments are standard Laravel…
DatsunBing
  • 8,684
  • 17
  • 87
  • 172
0
votes
2 answers

How can I increase performance of querying in a loop using Laravel's query builder?

Currently, I have 3 tables: A customer can have a thousand invoices, and an invoice can have thousand of payments too. My current query looks like this: $invoices = DB::table('invoices') ->where('customer_id', $customer_id) …
wobsoriano
  • 12,348
  • 24
  • 92
  • 162
0
votes
1 answer

Laravel DB facade select dynamicaly

i am trying to make an dynamical select with db facade in Laravel. $EntrepriseSurBAseDuNace = DB::table ('enterpriseAddress') ->join('enterpriseEnterprise', 'enterpriseEnterprise.EnterpriseNumber', '=',…
karl
  • 5
  • 4
0
votes
0 answers

Remove Whitespace from table inputs

I have an active database with username columns but I later discovered it has a lot of whitespace which causes a not found error when I try to compare a record against itself. So I am trying to remove all white space from all user names, here is the…
M'Baku
  • 320
  • 4
  • 18
0
votes
0 answers

Laravel select distinct value

I have the following request $latestTrailers = DB::table('game_trailer') ->join('trailers', 'trailers.id', '=', 'game_trailer.trailer_id') ->join('games', 'games.id', '=', 'game_trailer.game_id') …
M.Pau
  • 147
  • 1
  • 3
  • 12
0
votes
1 answer

Laravel DB Fasade for Join query with a union()

When I have set up a ".env" for using two DBs, also made code as below for use it. but where() method was incorrect to use it. Could you tell me more detailed usages to use where() method with explanation or tell some link to study? Thanks in…
JsWizard
  • 1,663
  • 3
  • 21
  • 48
0
votes
1 answer

Laravel DB facade to use several DB

Below is how to use Facade for search table data with pagination in Laravel. DB::table('customers')->paginate(15); but it can be use just a DB, So how to use several DB in Facade sentence? I wish to use DB as divide as read and write DB or direct…
JsWizard
  • 1,663
  • 3
  • 21
  • 48
0
votes
1 answer

facade always passing test never matter what return I expect

SkillAssessment::shouldReceive('addTwoNumbersAndAddName') ->with(3,5,'john') ->andReturn('thisstring is random and always passes anyway1341234123412343')->once(); A very basic mockup, expected return is: 8 john so what I wanted to write…
Toskan
  • 13,911
  • 14
  • 95
  • 185
0
votes
2 answers

Call a function on creation of new facade instance in laravel

Basically let's say I have a model named 'Window'. I know laravel provides created event for new instances of the model, the problem is I don't always first create new database records so that the method is called, but I sometimes need to create an…
D. Petrov
  • 1,147
  • 15
  • 27
0
votes
2 answers

How to connect 'users' table with 'post' table in laravel?

This is my structure, I want to connect these two tables in laravel, How to do it? Post Table: public function up() { Schema::create('post', function (Blueprint $table) { $table->increments('post_id'); $table->string('post'); …
Mochi
  • 123
  • 8