0 experience to go until the next level!
In case you were wondering, you earn Laracasts experience when you:
Earned once you have completed your first Laracasts lesson.
Earned once you have earned your first 1000 experience points.
Earned when you have been with Laracasts for 1 year.
Earned when you have been with Laracasts for 2 years.
Earned when you have been with Laracasts for 3 years.
Earned when you have been with Laracasts for 4 years.
Earned when you have been with Laracasts for 5 years.
Earned when at least one Laracasts series has been fully completed.
Earned after your first post on the Laracasts forum.
Earned once 100 Laracasts lessons have been completed.
Earned once you receive your first "Best Reply" award on the Laracasts forum.
Earned if you are a paying Laracasts subscriber.
Earned if you have a lifetime subscription to Laracasts.
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.
Earned once you have achieved 500 forum replies.
Earned once your experience points passes 100,000.
Earned once your experience points hits 10,000.
Earned once 1000 Laracasts lessons have been completed.
Earned once your "Best Reply" award count is 100 or more.
Earned once your experience points passes 1 million.
Earned once your experience points ranks in the top 50 of all Laracasts users.
bestmomo left a reply on Administration
Thank you fort interesting answers but my initial question is on code organisation :)
bestmomo left a reply on Auth::user(); Authentication In Core Php
I made something with Laravel 5.2 to use it with code PHP :
require getcwd() . '/../../../../bootstrap/autoload.php'; // Adapt to your path
$app = require_once getcwd() . '/../../../../bootstrap/app.php';
$kernel = $app->make('Illuminate\Contracts\Http\Kernel');
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$id = $app['encrypter']->decrypt($_COOKIE[$app['config']['session.cookie']]);
$app['session']->driver()->setId($id);
$app['session']->driver()->start();
Then you have Laravel in $app and use $app['auth'] I dont know if it still works with 5.7 version.
bestmomo left a reply on How To Require Npm Packages After Installing It In Laravel?
Look at documentation.
bestmomo left a reply on UPGRADE TO LARAVEL 5.7 FROM 5.4
For a clean upgrade install Laravel 5.7 and copy all files. Seems longer but you'll spend less time with bugs tracking ;)
bestmomo left a reply on Is This Good Approach To Have Own Service Provider?
With an empty string ?
bestmomo left a reply on Using Auth::user(); In Core Php
I made something with Laravel 5.2 to get Laravel app from core PHP :
require getcwd() . '/../../../../bootstrap/autoload.php';
$app = require_once getcwd() . '/../../../../bootstrap/app.php';
$kernel = $app->make('Illuminate\Contracts\Http\Kernel');
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$id = $app['encrypter']->decrypt($_COOKIE[$app['config']['session.cookie']]);
$app['session']->driver()->setId($id);
$app['session']->driver()->start();
Dont know if it works with recent Laravel version but it's a way. You can use $app['auth'] for example.
bestmomo left a reply on Is This Good Approach To Have Own Service Provider?
There is no rule, make as you feel. Code organisation is a story of personal covenant unless the development is done by several people, so they have to agree...
bestmomo started a new conversation Administration
I have explored the available packages to facilitate the construction of an administration: Voyager, LaraAdmin, Backpack, Boilerplate (not Nova which is a paid solution and I code only for fun) and others ... But I can not satisfy myself and I ended almost systematically to create something in my own way ...
But whether it is a package or the personal code we end up with a transplant not necessarily well digested. I like the isolation of treatments because it makes things clearer. At the code level it's easy but when we reason more globally it becomes problematic.
So I thought after all why not completely distinguish frontend and backend with two separate installations of Laravel (or other)? The advantage of the package-specific separation is preserved without the inconvenience of code complexity and mandatory entanglements. It is also easy to reuse the code by enriching it with each project by providing optional features for example.
I think that I will adopt this approach for my next project but I would like to have your opinion on the subject ...
bestmomo left a reply on Array Combine Totals
Not sure to understand your question but array_merge is always working.
bestmomo left a reply on How To Pass Additional Parameters To Resource Class?
I made a test, you can add an attribute to your model and after send it to your resource. It works.
I made a simple UserResource and :
$user = User::find(1);
$user->test = 'ok';
$resource = new UserResource($user);
dd($resource);
I get that for the resource :
#attributes: array:12 [▼
"id" => 1
"name" => "Adam"
...
"test" => "ok"
]
bestmomo left a reply on Is Bootstrap-multiselect Plugin Is Compatible With Bootstrap 4.1 ?
Maybe you can use this PR to make it work with Bootstrap 4.
bestmomo left a reply on Want To Access A Particular Array Element.
Could you show dd($data['Documents']) ?
bestmomo left a reply on Database Design / One To Many
I would create a One To One relation between Image and Product (Image has one Product with foreign key on Product).
I dont really understand, you load relation only if you use productImages().
bestmomo left a reply on How To Pass Additional Parameters To Resource Class?
Why not just add this to gift ?
$gift->from = 'PlaceController';
bestmomo left a reply on Route For Different User Types
Just send 2 parameters and update your middleware code. Look at documentation.
bestmomo left a reply on Append To And Modify Users Collection In Controller Before Pass It To View
I think now it's perfect ;)
bestmomo left a reply on Append To And Modify Users Collection In Controller Before Pass It To View
Hello,
With your solution you send 3 queries to database, not really optimized. Maybe this kind of code is better :
$all = collect(User::all()->toArray());
$users = $all->where('competition1', 'yes')->map(function($item, $key) {
$item['location'] = 'foo';
return $item;
})->concat($all->where('competition2', 'yes')->map(function($item, $key) {
$item['location'] = 'bar';
return $item;
})->concat($all->where('competition3', 'yes')->map(function($item, $key) {
$item['location'] = 'some';
return $item;
})));
dd($users);
bestmomo left a reply on I Search Datepicker Compatible With Bootstrap 4.1/blade
Maybe this one.
bestmomo left a reply on Query With Count And GroupBy
If you use Eloquent just do that :
$regios = App\Regio::withCount('inscricoes')->get();
bestmomo left a reply on Difference Between !== & !=
From manual :
$a !== $b Not identical TRUE if $a is not equal to $b, or they are not of the same type.
bestmomo left a reply on Property [id] Does Not Exist On This Collection Instance!!!!
@Snapey :)
bestmomo left a reply on Property [id] Does Not Exist On This Collection Instance!!!!
Let's show some code. Maybe you try to get attribute on collection without iterate...
bestmomo left a reply on Photos Gallery
Done ;)
bestmomo started a new conversation Photos Gallery
For information I put on Github an example of a photo gallery.
It serves as the basis for a series of French turoriels on my blog.
bestmomo left a reply on Load Js Dependecy In My Bootstrap.js
Luckily there is something else that bootstrap and jquery :)
bestmomo started a new conversation Bug In Mix ?
Say in my resources/js/app.js
I add a require for sweetalert :
window._ = require('lodash');
window.Popper = require('popper.js').default;
window.swal = require('sweetalert2');
So I launch npm run dev. My sweetalert is not loaded. But now if i change a bit :
window._ = require('lodash');
window.swal = require('sweetalert2');
window.Popper = require('popper.js').default;
It works !
I have tried with other libraries with same result...
Any idea ?
Thanks
bestmomo left a reply on Delete File From Dir With Unlink
Even the core doesn't use the FileSystem ^^
In UpCommand Console command :
@unlink(storage_path('framework/down'));
bestmomo left a reply on Eloquent Get Insert Id
When you create a record with Eloquent you get the id in the model :
$flight = App\Flight::create(['name' => 'Flight 10']);
$id = $flight->id;
bestmomo left a reply on Route With Names Issue
When you use get you get a collection of elements and you must iterate, if you have only one element use first or firstOrFail.
bestmomo left a reply on Helper Function
Happy it works now ;)
bestmomo left a reply on [SOLVED]Requests Not Validating Contact Form
I suppose you use flash package, I never used it but did you installed it correctely ?
bestmomo left a reply on [SOLVED]Requests Not Validating Contact Form
Looks like I got the good answer above ^^
bestmomo left a reply on Helper Function
Do you use some contact variable on this page ?
bestmomo left a reply on Requests Not Validating Contact Form
Remove this line in ContactFormRequest :
use Illuminate\Foundation\Http\FormRequest;
//use App\Http\Controllers\ContactFormRequest;
use App\Mail\ContactEmail;
use Flash;
bestmomo left a reply on Helper Function
With this code you cant get Undefined variable contact...
bestmomo left a reply on Helper Function
Do you really use this code :
<?php
if (!function_exists ('sections')) {
function sections()
{
return \App\Models\Section::all();
}
}
if (!function_exists ('site_data')) {
function site_data()
{
return \App\Models\SiteData::first();
}
}
if (!function_exists ('social')) {
function social()
{
return \App\Models\Social::first();
}
}
if (!function_exists ('contact')) {
function contact()
{
return \App\Models\Contact::first();
}
}
bestmomo left a reply on Helper Function
Remove these lines :
namespace App\Http;
class helpers
{
It's not a class just a php file with functions
bestmomo left a reply on Helper Function
Dont forget namespaces :
<?php
if (!function_exists ('sections')) {
function sections()
{
return \App\Models\Section::all();
}
}
if (!function_exists ('site_data')) {
function site_data()
{
return \App\Models\SiteData::first();
}
}
if (!function_exists ('social')) {
function social()
{
return \App\Models\Social::first();
}
}
if (!function_exists ('contact')) {
function contact()
{
return \App\Models\Contact::first();
}
}
bestmomo left a reply on Helper Function
Why not simple like that :
if (!function_exists ('sections')) {
function sections()
{
return \App\Models\Section::all();
}
}
...
bestmomo left a reply on Helper Function
I have updated my answer.
bestmomo left a reply on How To Access Public Path Image
$output = '
<td><img height="50" src="' . url("/imageslogo-1.png") . '" alt="Image"/></td>
'
bestmomo left a reply on Helper Function
The simple way is to create an app/helper.php file for all your helper functions and load it with composer :
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"files": [
"app/helpers.php"
],
"psr-4": {
"App\": "app/"
}
},
In your helper file you set your helper methods, for example :
<?php
if (!function_exists ('currentRoute')) {
function currentRoute(...$routes)
{
foreach ($routes as $route) {
if (request ()->url () == $route) {
return ' active';
}
}
}
}
bestmomo left a reply on Helper Function
Why do you extend Controller to make an helper ?
bestmomo left a reply on Get Google Places
Look at the API, there are Optional parameters for that.
bestmomo left a reply on How To Access Public Path Image
I dont understand how you manage your code. Why dont you use Blade for this ?
bestmomo left a reply on Laravel 5.7 Email Confirmation
Now I've got it ;)
bestmomo left a reply on Laravel 5.7 Email Confirmation
Right, I made copy and paste to have link and got &
, thanks ;)
bestmomo left a reply on Laravel 5.7 Email Confirmation
Yes I did all that is said in doc : implements MustVerifyEmail in User and 'verify' => true in routes.